Page 1 of 1

Standard File dialog filters

Posted: Fri Sep 26, 2003 1:00 am
by agadgil
I need to display a standard file dialog which can allow me to browse in files. I do use input type = file, such that a standard file dialog is displayed. But the filter is defaulted to "All files". I want to chnage it to "Picture files". Any suggestions.

Posted: Fri Sep 26, 2003 2:56 am
by JayBird
try something like this

Code: Select all

<input name="file" type="file" accept="image/gif">
Just change the MIME type to suit.

You can add multiple MIME types separated by a comma.

Unfortunatley, most modern browsers ingnore the accept= parameter. As a suggestion, you could code this function into the upload script to screen for file type, if the file is an picture file then go ahead and accept it, if it isn't a picture file then spit out a message that only picture files are accepted for upload.


Mark