输入接受=“image / png”在Firefox中不起作用 [英] Input accept="image/png" is not working in Firefox
问题描述
<input type="file" accept="image/png">
预计文件对话框只接受png文件。但是 accept =image / png
在Firefox上不起作用。我怎样才能做到这一点?
P.S.它可以在Chrome浏览器中运行。
It's expected that the file dialog accepts png files only. But accept="image/png"
does not work on Firefox. How can I make it?
P.S. It works in Chrome.
推荐答案
显然,Firefox有一些特定的扩展类型。您可以在此处阅读有关此错误的更多信息。
Apparently there's an issue specific to Firefox with some extension types. You can read more about this bug here.
这个bug的最新更新来自几个月前,似乎还没有解决。现在,我会建议服务器端的文件检查,或者至少可以使用JavaScript来验证文件的扩展名。
The latest update on this bug is from a couple of months ago and it seems to not yet be resolved. For now, I would suggest server-side file-checking, or at the very minimum you can use JavaScript to verify the file's extension before it gets uploaded.
这篇关于输入接受=“image / png”在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!