HTML 中文件上传有效接受类型整理
`<input type="file" accept=".csv" />`
- 对于 Excel 文件 97-2003 (.xls),使用:
<input type="file" accept="application/vnd.ms-excel" />
- 对于 Excel 文件 2007+ (.xlsx),使用:
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
<input type="file" accept="text/plain" />
- 对于图像文件 (.png/.jpg/etc),使用:
<input type="file" accept="image/*" />
- 对于 HTML 文件(.htm、.html),使用
<input type="file" accept="text/html" />
- 对于视频文件(.avi、.mpg、.mpeg、.mp4),使用:
<input type="file" accept="video/*" />
<input type="file" accept="audio/*" />
<input type="file" accept=".pdf" />