[英]Trouble uploading json file with flask
You seem to have json
set as an file ending in your template by <input type="file" accept="json">
.您似乎已通过
<input type="file" accept="json">
将json
设置为以模板结尾的文件。 (The template is not supplied so I can't pinpoint the line. This is not an error of the backend (flask) but of the your template code (jinja/html). It would be nice if you could supply a MRE for such issues. (没有提供模板,所以我无法确定该行。这不是后端(烧瓶)的错误,而是您的模板代码(jinja/html)的错误。如果您能为此类提供MRE ,那就太好了问题。
For more information about <input type="file">
take a look at the MDN Documentation .有关
<input type="file">
的更多信息,请查看MDN 文档。
Example of correct accept
:正确
accept
示例:
<input type="file" accept=".json">
This will only allow *.json
file but keep in mind that users may supply other files manually and create a fallback or validation when parsing/ saving the file.这将只允许
*.json
文件,但请记住,用户可以手动提供其他文件并在解析/保存文件时创建后备或验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.