Article From:
Original: input:file upload type control of HTML5

HTML5Input:file upload type control

201490820 visits in August 29th of the year

One, input:file attribute

The attribute values are commonly used as follows:

accept:Represents the type of file MIME that can be selected. Multiple MIME types are separated by English commas. The commonly used MIME types are shown in the following table.

multiple:If you can select multiple files, the value value of multiple files is the virtual path of the first file.


Only PNG and GIF pictures can be selected

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


Multi file upload

<input id="fileId2" type="file" multiple="multiple" name="file" />

3、Common MIME types

Suffix name       MIMEName
*.3gpp    audio/3gpp, video/3gpp
*.ac3    audio/ac3
*.asf       allpication/
*.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/    
*.ogg    application/ogg, audio/ogg    
*.pdf    application/pdf    
*.png    image/png    
*.pot    application/    
*.pps    application/    
*.ppt    application/    
*.rtf            application/rtf, text/rtf    
*.svf           image/vnd.svf    
*.tif         image/tiff    
*.tiff       image/tiff    
*.txt           text/plain    
*.wdb    application/    
*.wps    application/    
*.xhtml    application/xhtml+xml    
*.xlc      application/    
*.xlm    application/

Leave a Reply

Your email address will not be published. Required fields are marked *