Forum Moderators: open

Message Too Old, No Replies

Specify file type for browsing

         

benj0323

7:03 pm on Jul 25, 2004 (gmt 0)

10+ Year Member



I was just curious. When having an input type=file, and the user clicks browse, it browses every document on their computer because the file type is set to "all files". Is it possible to specify which file type you want them to browse for. Like .jpg.

Thanks a lot for you help.

tedster

9:03 pm on Jul 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can include an ACCEPT= attribute. In the argument you specify the MIME types you want with a comma seperated list. A complete example could look like this:

<input type="file" ACCEPT="image/gif,image/jpeg">

I haven't had need for this myself, and I seem to remember from a few years back that browser support was said to be spotty. So you'll want to check it out and test the results.

benj0323

9:46 pm on Jul 25, 2004 (gmt 0)

10+ Year Member



Well its not a neccessity that this feature works. I just think it would make things less confusing for my clients.

Also I tested that out and it didnt work on IE or firefox.

Thanks for your help though.

tedster

4:07 am on Jul 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tested that out and it didnt work on IE or firefox

Thanks for that report - I was afraid that would be the answer. As far as I know, that is the only proposed HTML solution.