input:file上传文件类型(记录)

Posted yanqiong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了input:file上传文件类型(记录)相关的知识,希望对你有一定的参考价值。

imput 属性有以下几种:

1.type:input类型这就不多说了
2.accept:表示可以选择的文件类型,多个类型用英文逗号分开,常用的类型见下表。

<input id="file" type="file" accept="image/png,image/gif" name="file" />
  • 1

3.multiple:是否可以选择多个文件,多个文件时其value值为第一个文件的虚拟路径。

<input id="files" type="file" multiple="multiple" name="file" />
  • 1

下面就是各种文件类型

*.3gpp    audio/3gpp, video/3gpp
*.ac3    audio/ac3
*.asf       allpication/vnd.ms-asf
*.au           audio/basic
*.css           text/css
*.csv           text/csv
*.doc    application/msword    
*.dot    application/msword    
*.dtd    application/xml-dtd    
*.dwg    image/vnd.dwg    
*.dxf      image/vnd.dxf
*.gif            image/gif    
*.htm    text/html    
*.html    text/html    
*.jp2            image/jp2    
*.jpe       image/jpeg
*.jpeg    image/jpeg
*.jpg          image/jpeg    
*.js       text/javascript, application/javascript    
*.json    application/json    
*.mp2    audio/mpeg, video/mpeg    
*.mp3    audio/mpeg    
*.mp4    audio/mp4, video/mp4    
*.mpeg    video/mpeg    
*.mpg    video/mpeg    
*.mpp    application/vnd.ms-project    
*.ogg    application/ogg, audio/ogg    
*.pdf    application/pdf    
*.png    image/png    
*.pot    application/vnd.ms-powerpoint    
*.pps    application/vnd.ms-powerpoint    
*.ppt    application/vnd.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    
*.wps    application/vnd.ms-works    
*.xhtml    application/xhtml+xml    
*.xlc      application/vnd.ms-excel    
*.xlm    application/vnd.ms-excel    
*.xls           application/vnd.ms-excel    
*.xlt      application/vnd.ms-excel    
*.xlw      application/vnd.ms-excel    
*.xml    text/xml, application/xml    
*.zip            aplication/zip    
*.xlsx     application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

以上是关于input:file上传文件类型(记录)的主要内容,如果未能解决你的问题,请参考以下文章

input file 上传文件类型大小检查

input file实现多选和限制文件上传类型

input file实现多选,限制文件上传类型,图片上传前预览功能

input file限制上传文件类型

input file 文件上传,js控制上传文件的大小和格式

input file 文件上传,js控制上传文件的大小和格式