Does anyone know how to use the accept attribute in input tags? I can see it documented, but w3schools indicates that it is not supported by any of the major browsers. Testing also confirms this.
I know that validation should be done server-side, and am doing that now. But it'd be nice to have it restrict the types of files in the file upload dialog for usability.
Edit: I am fully aware of the security implications of client-side only validation. I do not intend to remove server-side validation and am looking for a way to improve usability.
The reason why browsers don't actually implement the
ACCEPT
attribute is that MIME type validation is a science and not just as easy as reading a file extension. Even server-side MIME type verification can be difficult as noted by MediaWiki:http://www.mediawiki.org/wiki/Manual:Mime_type_detection
Notice they attempt to verify the MIME type even server-side.