Input accept attribute in Firefox

According to MDN accept=[MIME type] is supported in Firefox. However, I tried the following to no avail:

<input type="file" accept="text/html">

It doesn’t filter the HTML files: [B]demo[/B].
Is it a bug or am I missing something?

hope this helps

It doesn’t help. Thanks, anyway!

hope this helps

Even if it did work, it is trivial for anyone to bypass and upload whatever file type they want. For example a one line user JavaScript added to the page could strip out the attribute.

Therefore the file type needs to be tested on the server regardless and once you have the file type being tested there it then becomes irrelevant whether the attribute in the HTML works or not.

The browser support to the accept attribute is poor and buggy, and felgall is right anyway.

On the other hand, w3schools is not a very recommendable reference to solve this (or any other problem). You’d better rely on the Reference section of this site. And in this particular case the following page:

Just have a look at the compatibility and see that it is buggy in all the browsers.

This is why, although I will often check the MDN for known things, I don’t trust it for many attributes that I can’t tell if they are custom to Mozilla or not. MDN treats both custom and spec things the same, making it almost never my last stop.