有没有办法在默认的文件选择器对话框中只显示.xxx文件。xxx可能是未知的文件类型,如abc、efg等。
我使用的是html5,所以它可能对这类东西有新的支持。
谢谢!
发布于 2012-12-12 16:54:09
file
输入元素上的HTML 5 accept
attribute就是为了这个目的。例如:
<input type="file" accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
发布于 2017-09-22 20:29:22
对于其他人来说,这里有一些非常方便的预定义集:
<input type="file" accept="image/*"/>
<input type="file" accept="video/*"/>
<input type="file" accept="audio/*"/>
https://stackoverflow.com/questions/13835883
复制相似问题