When uploading a file, you need to restrict the specified file type.
<input type= "File" accept= "image/*"/>
Accept indicates that the file type can be uploaded, image represents a picture, * represents 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 |
*.au |
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 |
Graphic 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 Stream, Layer II |
*.mp3 |
Audio/mpeg |
MPEG Audio Stream, Layer III |
*.mp4 |
Audio/mp4, Video/mp4 |
MPEG-4 Audio/video |
*.mpeg |
Video/mpeg |
MPEG Video Stream, Layer II |
*.mpg |
Video/mpeg |
MPEG Video Stream, Layer II |
*.mpp |
Application/vnd.ms-project |
MS Project Project |
*.ogg |
Application/ogg, Audio/ogg |
Ogg Vorbis |
*.pdf |
Application/pdf |
Portable Document Format |
*.png |
Image/png |
Portable Network Graphics |
*.pot |
Application/vnd.ms-powerpoint |
MS PowerPoint Template |
*.pps |
Application/vnd.ms-powerpoint |
MS PowerPoint Slideshow |
*.ppt |
Application/vnd.ms-powerpoint |
MS PowerPoint Presentation |
*.rtf |
Application/rtf, Text/rtf |
Rich Text Format |
*.svf |
Image/vnd.svf |
Simple Vector Format |
*.tif |
Image/tiff |
Tagged Image Format File |
*.tiff |
Image/tiff |
Tagged Image Format File |
*.txt |
Text/plain |
Plain Text |
*.wdb |
Application/vnd.ms-works |
MS Works Database |
*.wps |
Application/vnd.ms-works |
Works Text Document |
*.xhtml |
Application/xhtml+xml |
Extensible Hypertext Markup Language |
*.xlc |
Application/vnd.ms-excel |
MS Excel Chart |
*.xlm |
Application/vnd.ms-excel |
MS Excel Macro |
*.xls |
Application/vnd.ms-excel |
MS Excel Spreadsheet |
*.xlt |
Application/vnd.ms-excel |
MS Excel Template |
*.xlw |
Application/vnd.ms-excel |
MS Excel Workspace |
*.xml |
Text/xml, Application/xml |
Extensible Markup Language |
*.zip |
Aplication/zip |
Compressed Archive |
HTML Input Accept Type