Results 1 to 5 of 5

Thread: HTML: Input Files and Accept?

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    HTML: Input Files and Accept?

    For an input type of file, how do you use the attribute? I know it accepts context types, but I'm not sure what I would put if I wanted only .gif and .jpg images to show up.

    I also know that they can still get a different type of file in there, so I'll also check it on the server side, but I'd like to only have it initially show those two file types.

    I tried searching the forum (but not the web much), and didn't find an answer.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I've tried:

    Code:
    <input type="file" name="f_1" accept="image/gif, image/jpg">
    But it doesn't seem to work.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Addicted Member
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    175
    Originally posted by The Hobo
    I've tried:

    Code:
    <input type="file" name="f_1" accept="image/gif, image/jpg">
    But it doesn't seem to work.
    It should work, that's the proper code.
    BUT, this method is very unreliable, because it basically tells the browser that only those types are allowed, and that can be easily changed so that the browser allows all types.

    If you are using IE, it might be like that, not too sure though.
    Gary W Web Developer & Designer
    Visual Basic 6

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by Gary W
    It should work, that's the proper code.
    BUT, this method is very unreliable, because it basically tells the browser that only those types are allowed, and that can be easily changed so that the browser allows all types.

    If you are using IE, it might be like that, not too sure though.
    Yeah, but I'm checking the file type server-side (PHP) anyways. I just wanted that there as a little added bonus or something. Just for looks, I suppose.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    Addicted Member
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    175
    Yep I know you are using PHP as well to check the filetype, but I was just answering your question.
    Gary W Web Developer & Designer
    Visual Basic 6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width