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"

结果:

 

 

 

posted @ 2020-05-03 09:22  codeing123  阅读(7247)  评论(0编辑  收藏  举报