Add an Input File HTML control on the webpage:
<input ID = file1 type = file />
This is the case by default. All file types will be displayed. If you want to limit it, it only displays the file types we set, such as word, excel, PDF file
The solution is to add an access attribute to it, such as::
<input ID = file1 type = file access = .xls, .doc, .txt, .pdf />
When choosing this way, it will be displayed by default:
The file selection box only shows the files of your custom file type, which is also more convenient.
However, this is just the simplest and eye -catching approach. You can still choose other file types:
Therefore, if you want to realize the type and practice in the real sense (in fact, this is not a limit, it just shows the type of file type you want, not to say that you cannot choose other things), or you have to control it through JS or backstage to control it. Essence
Supported file type:
*.3GPP Audio/3GPP, Video/3GPP 3GPP Audio/Video*.ac3 Audio/AC3 AC3 AUDIO*.asf AllPication/VND.MS-ASF Advanced FORMAT*.ao AUDIO/BAS IC AUDIO*.css Text/CSS Cascading STYLE Sheets*.csv Text/CSV Commission Values*.doc Application/MSWord MS Word Document*.dot Application/MSWord MS Word Template*.dd Application/ XML-DTD Document Type definition*.dwg Image/VND.DWG Autocad Drawing Database*.dxf Image/VND.DXF AutoCAD DrawIn Interchange Format*.gif Image/GIF GRAPHIC Interchange Format*.htm Text/HTMLTEXT MARKUP LANGUGE* .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 applicati ON/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/MPEG MPEG Video Stream, Layer II*. MPG Video/MPEG MPEG VIDEO Stream, Layer II*.mp Application/VND.MS-Project MS Project Project*.OGG Application/OGG, Audio/OGG OGG Vorbis*.pdf a pplication/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 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*.tiffff Tagged Image 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 HyperterteRTEX 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 Compresses
The above is all the contents of this article. I hope it will be helpful to everyone's learning. I also hope that everyone will support VEVB Wulin.com.