Forum Moderators: open

Message Too Old, No Replies

<input type=file accept=...> not working

         

tu89

11:13 pm on Sep 12, 2001 (gmt 0)



I'm trying to use the <input type=file accept=...> HTML tag with the ACCEPT option but it doesn't seem to work for me. For example I write:

< input type=file name=files accept="html" >

and hope that the file upload window that pops up will have a filter set for html files. However, my browser ignores it.

Am I missing something?

Air

2:14 am on Sep 13, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld tu89.

>Am I missing something?

No you are not missing anything, 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 .html file then go ahead and accept it, if it isn't an .html file then spit out a message that only .html files are accepted for upload.

I do this for a site where I want only .jpg and .gif files that are under a certain size accepted for upload and it works well.

Hope that helps.

tu89

9:08 pm on Sep 13, 2001 (gmt 0)



Thanks!