Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
October 19, 2005, 6:12 am
rate this thread
<input type="file" name="FILEFILENAME" value="">
to get file input dialogs. My questions are:
(1) Is it possible to add a bunch of file filters to the opening dialog
box? (*.txt, *.doc, etc etc)
(2) Is it possible to get the type of file selected in the dialog?
Meaning the index of the element if (1) is possible, so that you could
mess around with it in the java script.
If both the above are not possible... is anyone at the W3C thinking
about adding this neat feature into the HTML spec in the near future?
Re: HTML Forms, file input. How extensible is it?
There is the 'accept' attribute for the INPUT element which takes a list of
MIME types (not file suffixes). Don't know if this is handled by any
You could look at the selected filename (in fact it could be a list of
filenames, but most browsers do not support selecting multiple files...) at
see, if it has a known suffix. But keep in mind that the connection between
filetype and suffix is pretty arbitrary and that there are operating
systems that do not use this concept at all.
The only reliable way to determine the filetype is by looking at the file
contents, e.g. using the UNIX 'file' tool. And you have to do this on the
server side of course.
Email: pink at odahoda dot de
WWW: http://www.odahoda.de /
- » How to define links (css?) for just one part of a html page?
- — Next thread in » HTML Authoring Forum