繁体   English   中英

怎么做<input type="file">只接受 .py 和 .json 文件

[英]How to make <input type="file"/> accept only .py and .json files

我正在尝试仅导入 .py 和 .json 文件,并将接受作为text/x-python-script、application/json、text/x-python传递

在 windows 操作系统中,只能导入.json文件,而不是python文件。

传递 python 文件的文件扩展名而不是 MIME 类型

<input type="file" accept="application/json,.py" />

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM