简体   繁体   中英

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

I am trying to import only.py and.json file, and passing accept as text/x-python-script, application/json, text/x-python

In windows OS, only .json files are able to get imported not the python file.

Pass the filename extension for python files instead of the MIME type

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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