accept上传格式限制
1.上传.csv格式的
<input text="file" accept=".csv" />
2.上传.xls格式
<input text="file" accept="application/vnd.ms-excel"/>
3.上传.xslx格式
<input text="fiel" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"/>
4.上传.png/.jpg/etc格式
<input type="file" accept="text/plain" />
5.上传图片格式
<input type="file" accept="image/*" />
6.上传.htm,.html格式
<input type="file" accept="text/html" />
7.上传video(.avi, .mpg, .mpeg, .mp4)格式
<input type="file" accept="video/*" />
8.上传audio(.mp3, .wav, etc)格式
<input type="file" accept="audio/*" />
9.上传.pdf格式
<input type="file" accept=".pdf" />
10.如果限制两种文件格式,同时限制
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel">
记录一下,省得找找找…
HTML上传文件格式限制指南
这篇博客详细列举了HTML中用于上传不同文件类型的`<input type=file>`标签的`accept`属性设置,包括.csv、.xls、.xlsx、.png/.jpg等常见格式,以及audio、video和.pdf等。同时还展示了如何限制接受多种文件格式的示例。
3284

被折叠的 条评论
为什么被折叠?



