File Browser - file type filtering

  • Thread starter Thread starter David Laub
  • Start date Start date
D

David Laub

I'm trying to use the HTML file selection form "control" with a MIME type
accept filter. - see the following code snippet:

<input name="fileUpload" id="File" type="file" size="21" accept="image/*" />

I'm struggling at two levels:

1) mapping the MIME types (e.g. image) to actual file types (e.g. jpg) - I
have found "complete" lists on the net, but wonder how complete/up to date
they are - what I REALLY want to do is filter for Excel files: I can find
something for MSWord (e.g. MIME application/msword) but nothing for Excel)

2) here's the bigger problem: when I add the accept attribute to the input
tag, (usually) NOTHING happens when I display the HTML page - the browser
merely shows All Files in the files of type drop down list. Sometimes I DO
see pictures added to the drop down list, but when this happens I also get
HTML added to the drop down list, even through I did not specify it.

So if someone knows how to make the accept attribute work I'd be grateful.
And if someone knows how to fully map the accept values to "standard" file
types, I'd be even more grateful.

Thanks

David Laub
 
application/vnd.ms-excel
cover extensions - xla, xlc, xlm, xls, xlt, xlw

hope that helps

anything else just email me @ (e-mail address removed)
 
your best bet would be to use some javascript to check the
file extension before it is uploaded. Browsers only use
the accept part to help out the user.


You also need to include the enctype of the type of file.


-Derrick
(e-mail address removed)
 
Back
Top