This is my upload input and no matter what I try it refuses the display Powerpoint PPS files.
It displays PDF, PPT, PPTX, PPSX but not PPS
<input type="file"
accept="application/pdf,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.slideshow,application/vnd.openxmlformats-officedocument.presentationml.presentation"
name="upldInput"/>
The behavior is same in all the browsers, no one shows PPS files.
I can't find a MIME type that works. However, the following does work:
<input type="file" accept="application/pdf,.pps" name="upldInput"/>
Apparently you can mix and match file extensions and MIME types. On Chrome 25 and IE 10 (PC) this gives the desired behavior, i.e. only the matched MIME type(s) or extensions are shown.
Demo: http://jsfiddle.net/GGFVv/
I've also tried mixing multiple extensions and multiple MIME types, which also seems to work.
<input type="file"
accept=".pps,
.jpg,
.txt,
application/pdf,
application/vnd.ms-powerpoint,
application/vnd.openxmlformats-officedocument.presentationml.slideshow,
application/vnd.openxmlformats-officedocument.presentationml.presentation" name="upldInput"/>
Demo: http://jsfiddle.net/GGFVv/2/
I should note that file extension filtering does not seem to work in Firefox 19. I imagine this is because of the differences between the behavior defined by the W3C and the WHATWG.
accept
accept
attributeThe original mention of accept
(in 1995!) is somewhat vague:
Allow an ACCEPT attribute for INPUT tag, which is a list of media types or type patterns allowed for the input.
Firefox appears to default to "all files" when it finds a value it doesn't recognize, so this is somewhat user-friendly (though not ideal).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With