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

时间:2020-05-03 10:44:08   收藏:0   阅读:1481
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"

结果:

技术图片

 

 

 

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!