<input type="file" />浏览时只显示指定文件类型
2015-04-17 21:38
936 查看
<input type="file" accept="application/msword" >
accept属性列表
1.accept="application/msexcel"
2.accept="application/msword"
3.accept="application/pdf"
4.accept="application/poscript"
5.accept="application/rtf"
6.accept="application/x-zip-compressed"
7.accept="audio/basic"
8.accept="audio/x-aiff"
9.accept="audio/x-mpeg"
10.accept="audio/x-pn/realaudio"
11.accept="audio/x-waw"
12.accept="image/gif"
13.accept="image/jpeg"
14.accept="image/tiff"
15.accept="image/x-ms-bmp"
16.accept="image/x-photo-cd"
17.accept="image/x-png"
18.accept="image/x-portablebitmap"
19.accept="image/x-portable-greymap"
20.accept="image/x-portable-pixmap"
21.accept="image/x-rgb"
22.accept="text/html"
23.accept="text/plain"
24.accept="video/quicktime"
25.accept="video/x-mpeg2"
26.accept="video/x-msvideo"
这个就可以实现选择具体的数据类型,但是有兼容问题,我在测试的时候只有Opera,Chrome能用,火狐和IE都不兼容
如果想支持多种类型的话,可以在accept里面放置多个属性就可以了:
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
如果不限制图像的格式,可以写为:accept="image/*"
accept属性列表
1.accept="application/msexcel"
2.accept="application/msword"
3.accept="application/pdf"
4.accept="application/poscript"
5.accept="application/rtf"
6.accept="application/x-zip-compressed"
7.accept="audio/basic"
8.accept="audio/x-aiff"
9.accept="audio/x-mpeg"
10.accept="audio/x-pn/realaudio"
11.accept="audio/x-waw"
12.accept="image/gif"
13.accept="image/jpeg"
14.accept="image/tiff"
15.accept="image/x-ms-bmp"
16.accept="image/x-photo-cd"
17.accept="image/x-png"
18.accept="image/x-portablebitmap"
19.accept="image/x-portable-greymap"
20.accept="image/x-portable-pixmap"
21.accept="image/x-rgb"
22.accept="text/html"
23.accept="text/plain"
24.accept="video/quicktime"
25.accept="video/x-mpeg2"
26.accept="video/x-msvideo"
这个就可以实现选择具体的数据类型,但是有兼容问题,我在测试的时候只有Opera,Chrome能用,火狐和IE都不兼容
如果想支持多种类型的话,可以在accept里面放置多个属性就可以了:
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
如果不限制图像的格式,可以写为:accept="image/*"
相关文章推荐
- <input type="file" />浏览时只显示指定文件类型
- <input type="file" />浏览时只显示指定文件类型
- <input type="file" />浏览时只显示指定文件类型
- <input type="file">定义样式并获取上传文件路径及指定文件类型
- <input type="file" />浏览时只显示指定文件类型
- <input type="file" />浏览时只显示指定文件类型
- <input type="file" />浏览时只显示指定文件类型
- <input type="file" />浏览时只显示指定文件类型
- <input type="file">更改 页面显示 浏览 为上传 .
- html input="file" 浏览时只显示指定文件类型 xls、xlsx、csv
- asp.net/c# 用<input type="file" />实现文件上传,multipart/form-data
- 使用<input type="file">实现文件上传
- <input type="file">定义样式并获取上传文件路径及指定文件类型
- html input="file" 浏览时只显示指定文件类型 xls、xlsx、csv
- html input="file" 浏览时只显示指定文件类型 xls、xlsx、csv
- <input type="file" >判断上传的文件是zip和rar类型
- <input type="button" style="display:none">隐藏按钮显示
- <input type="file" />accept属性列表
- input file控件限制上传文件类型 网页上添加一个input file HTML控件: 1 <input id="File1" type="file" /> 默认是这样的,所有文件类
- <input type="file"/> 文件上传