浏览时只显示指定文件类型 xls、xlsx、csv
<input id="fileSelect" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
其实也可以这样写
<input id="fileSelect" type="file" accept=".csv, .xls,.xslx" />
另外:
导入csv文件:
<input type="file" accept=".csv" />
导入xls文件:
<input type="file" accept="application/vnd.ms-excel" />
导入xlsx文件:
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
导入txt文件:
<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/*" />
导入音频文件 (.mp3, .wav, etc), use:
<input type="file" accept="audio/*" />
导入PDF文件:
<input type="file" accept=".pdf" />