html - input[type=file] 的接受属性允许其他扩展

标签 html file

有人知道为什么这个输入接受 .php 文件扩展名吗?

(至少在最新版本的 chrome 中)

<input type="file" accept=".doc,.pdf,.txt,.rtl">

enter image description here

最佳答案

这显然是 Mac Os 独有的错误。
我无法从我的 win10 VM 重现它,但它仍然存在于 v.55.0.2861.0 canary 中。


问题似乎来自.txt
就像它会接受任何 text/* 文件一样,设置此扩展名。

您可以加注星标this chromium issue它处理相同的潜在问题(具有不同的扩展名)。

<input type="file" accept=".txt">

关于html - input[type=file] 的接受属性允许其他扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39508849/

相关文章:

c++ - 打印出文件的最后 10 行

java - 获取绝对 java.nio.Path

file - Nodejs 文件权限

java - 搜索文件中的编码标签

javascript - 我们可以将哪些信息作为参数传递给内联事件处理程序?

html - 如何在轮播元素标签p中添加媒体查询

php - 如何在不重定向到另一个页面的情况下验证用户的用户名和密码?

c - 写入大量信息时 fprintf 出现问题

css - 如何从输入中删除类似井的边框?

Javascript/jQuery : Why different result for event. 目标使用 <a> 标签对比。 console.log 中的其他元素,注意 $(this) 的 alert()