input file文件上传的默认弹框是全部文件,但是有时候在写项目的时候为了方便会让其默认选中xls文件或者
图片,因此需要对其添加一个accept来实现这个功能
具体代码如下:
<!-- 默认全部 -->
<input type="file" name="">
<!-- 默认xls -->
<input type="file" accept="application/vnd.ms-excel">
<!-- 默认图片gif和jpeg两种 -->
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
<!-- 默认图片,不限格式 -->
<input type="file" name="pic" id="pic" accept="image/*" />