Recently, the mobile terminal was developed, and the customer requested to click upload at the uploading point, and the photo album and photo function would pop up directly. After the test, it is found that the file type limit can be added, but different system calls are different.
Differences: Apple displays for files and photos, Android for photo albums and photos (one way that comes to mind is custom calls). But here is the system difference, we will ignore it for now.
When uploading files, you need to limit the specified file types.
<input type="file" accept="image/*" />
accept indicates that the file type can be uploaded, image indicates a picture, and * indicates all supported formats.
accept can specify the following information:
*.3gpp |
audio/3gpp, video/3gpp |
3GPP audio/video |
* .ac3 |
audio/ac3 |
AC3 Audio |
*.asf |
allpication/vnd.ms-asf |
Advanced Streaming Format |
*.to |
audio/basic |
AU audio |
*.css |
text/css |
Cascading Style Sheets |
*.csv |
text/csv |
comma separated values |
*.doc |
application/msword |
MS Word document |
*.dot |
application/msword |
MS Word Template |
*.dtd |
application/xml-dtd |
document type definition |
*.dwg |
image / vnd.dwg |
AutoCAD Drawing Database |
*.dxf |
image/vnd.dxf |
AutoCAD Drawing Interchange Format |
*.gif |
image/gif |
Graphics Interchange Format |
*.htm |
text/html |
Hypertext Markup Language |
*.html |
text/html |
Hypertext Markup Language |
*.jp2 |
image/jp2 |
JPEG-2000 |
*.jpe |
image/jpeg |
JPEG |
*.jpeg |
image/jpeg |
JPEG |
*.jpg |
image/jpeg |
JPEG |
*.js |
text/javascript, application/javascript |
JavaScript |
*.json |
application/json |
JavaScript Object Notation |
*.mp2 |
audio/mpeg, video/mpeg |
MPEG audio/video streaming, Layer 2 |
*.mp3 |
audio/mpeg |
MPEG audio/video streaming, Layer 3 |
*.mp4 |
audio/mp4, video/mp4 |
MPEG-4音频/视频 |
*.mpeg |
video/mpeg |
MPEG视频流,第二层 |
*.mpg |
video/mpeg |
MPEG视频流,第二层 |
*.mpp |
application/vnd.ms-project |
MS项目项目 |
*.ogg |
application/ogg, audio/ogg |
Ogg Vorbis |
|
application/pdf |
便携式文档格式 |
*.png |
image/png |
便携式网络图形 |
*.pot |
application/vnd.ms-powerpoint |
MS PowerPoint模板 |
*.pps |
application/vnd.ms-powerpoint |
MS PowerPoint幻灯片 |
*.ppt |
application/vnd.ms-powerpoint |
MS PowerPoint演示文稿 |
*.rtf |
application/rtf, text/rtf |
文本格式 |
*.svf |
image/vnd.svf |
简单的矢量格式 |
*.tif |
image/tiff |
标记的图像格式文件 |
*.tiff |
image/tiff |
标记的图像格式文件 |
*.txt |
text/plain |
纯文本 |
*.wdb |
application/vnd.ms-works |
MS Works数据库 |
*.wps |
application/vnd.ms-works |
工程文本文档 |
*.xhtml |
application/xhtml+xml |
可扩展的超文本标记语言 |
*.xlc |
application/vnd.ms-excel |
MS Excel图表 |
*.xlm |
application/vnd.ms-excel |
MS Excel宏 |
*.xls |
application/vnd.ms-excel |
MS Excel电子表格 |
*.xlt |
application/vnd.ms-excel |
MS Excel模板 |
*.xlw |
application/vnd.ms-excel |
MS Excel工作区 |
*.xml |
text/xml, application/xml |
可扩展标记语言 |
*.zip |
aplication/zip |
压缩的档案 |
..