html <input>设置上传文件类型为excel表格

html
<form>
<input type="file" class="form-control form-control-file"accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" name="importFile" id="importFile"> </form>
<!--For CSV files (.csv),use: 
.csv; For Excel Files 2003-2007 (.xls), use: application/vnd.ms-excel;
For Excel Files 2010 (.xlsx), use: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet -->

主要是:
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

结果:

 

猜你喜欢

转载自www.cnblogs.com/technicist/p/12820811.html