Php File Upload extension and file type table (covering almost all files)

Source: Internet
Author: User
Tags bmp image php file upload pkcs12 pkcs7 rfc822 gtar

There are many php File Upload classes on the Internet, and file upload processing is a special feature of php (at least this is shown in the manual as a feature of php, I personally think php has better array functions.) php learners all know how to upload files. However, many users may ignore some details during programming, that is, the object type (MIME ). Before submitting a file to php for processing in a form, the browser will parse and identify the type of file on one side, and then enter the php processing stage, php will identify the original type of the file to be parsed (it does not mean that you change the suffix to a file ). In this process, there will be some browser compatibility, which is more accurate to the problem of inconsistent file type resolution identifiers. In this way, php needs to make more judgments based on different browsers when processing Post files. The most typical difference is the difference between IE and Firefox.

Php uploads image files (gif, jpg, bmp, png, psd, ico)

In history, the most complete oophper pro test version of PHP File Upload corresponding to the file type table, ie, Firefox each copy.

Ie Firefox
Id Suffix File types identified by php
0 Gif Image/gif
1 Jpg Image/jpeg
2 Png Image/png
3 Bmp Image/bmp
4 Psd Application/octet-stream
5 Ico Image/x-icon
6 Rar Application/octet-stream
7 Zip Application/zip
8 7z Application/octet-stream
9 Exe Application/octet-stream
10 Avi Video/avi
11 Rmvb Application/vnd. rn-realmedia-vbr
12 3gp Application/octet-stream
13 Flv Application/octet-stream
14 Mp3 Audio/mpeg
15 Wav Audio/wav
16 Krc Application/octet-stream
17 Lrc Application/octet-stream
18 Txt Text/plain
19 Doc Application/msword
20 Xls Application/vnd. ms-excel
21 Ppt Application/vnd. ms-powerpoint
22 Pdf Application/pdf
23 Chm Application/octet-stream
24 Mdb Application/msaccess
25 SQL Application/octet-stream
26 Con Application/octet-stream
27 Log Text/plain
28 Dat Application/octet-stream
29 Ini Application/octet-stream
30 Php Application/octet-stream
31 Html Text/html
32 Htm Text/html
33 Ttf Application/octet-stream
34 Fon Application/octet-stream
35 Js Application/x-javascript
36 Xml Text/xml
37 Dll Application/octet-stream
38 Dll Application/octet-stream
Id Suffix File types identified by php
0 Gif Image/gif
1 Jpg Image/pjpeg
2 Png Image/x-png
3 Bmp Image/bmp
4 Psd Application/octet-stream
5 Ico Image/x-icon
6 Rar Application/octet-stream
7 Zip Application/x-zip-compressed
8 7z Application/octet-stream
9 Exe Application/octet-stream
10 Avi Video/avi
11 Rmvb Application/vnd. rn-realmedia-vbr
12 3gp Application/octet-stream
13 Flv Application/octet-stream
14 Mp3 Audio/mpeg
15 Wav Audio/wav
16 Krc Application/octet-stream
17 Lrc Application/octet-stream
18 Txt Text/plain
19 Doc Application/msword
20 Xls Application/vnd. ms-excel
21 Ppt Application/vnd. ms-powerpoint
22 Pdf Application/pdf
23 Chm Application/octet-stream
24 Mdb Application/msaccess
25 SQL Text/plain
26 Con Application/octet-stream
27 Log Text/plain
28 Dat Text/plain
29 Ini Application/octet-stream
30 Php Application/octet-stream
31 Html Text/html
32 Htm Text/html
33 Ttf Application/octet-stream
34 Fon Application/octet-stream
35 Js Text/html
36 Xml Text/xml
37 Dll Application/octet-stream
38 Class Application/java
* Application/octet-stream // application
323 text/h323th
Acx application/internet-property-stream
Ai application/postscript
Aif audio/x-aiff
Aifc audio/x-aiff
Aiff audio/x-aiff
Asf video/x-ms-asf
Asr video/x-ms-asf
Asx video/x-ms-asf
Au audio/basic
Avi video/x-msvideo
Axs application/olescript
Bas text/plain
Bcpio application/x-bcpio
Bin application/octet-stream
Bmp image/bmp
C text/plain
Cat application/vnd. ms-pkiseccat
Cdf application/x-cdf
Cer application/x-x509-ca-cert
Class application/octet-stream
Clp application/x-msclip
Cmx image/x-cmx
Cod image/cis-cod
Cpio application/x-cpio
Crd application/x-mscardfile
Crl application/pkix-crl
Crt application/x-x509-ca-cert
Csh application/x-csh
Css text/css
Dcr application/x-director
Der application/x-x509-ca-cert
Dir application/x-director
Dll application/x-msdownload
Dms application/octet-stream
Doc application/msword
Dot application/msword
Dvi application/x-dvi
Dxr application/x-director
Eps application/postscript
Etx text/x-setext
Evy application/envoy
Exe application/octet-stream
Fif application/fractals
Flr x-world/x-Fig
Gif image/gif
Gtar application/x-gtar
Gz application/x-gzip
H text/plain
Hdf application/x-hdf
Hlp application/winhlp
Hqx application/mac-binhex40
Hta application/hta
Htc text/x-component
Htm text/html
Html text/html
Htt text/webviewhtml
Ico image/x-icon
Ief image/ief
Iii application/x-iphone
Ins application/x-internet-signup
Isp application/x-internet-signup
Jfif image/pipeg
Jpe image/jpeg
Jpeg image/jpeg
Jpg image/jpeg
Jpg image/pjpeg
Js application/x-javascript
Latex application/x-latex
Lha application/octet-stream
Lsf video/x-la-asf
Lsx video/x-la-asf
Lzh application/octet-stream
M13 application/x-msmediaview
M14 application/x-msmediaview
M3u audio/x-mpegurl
Man application/x-troff-man
Mdb application/x-msaccess
Me application/x-troff-me
Mht message/rfc822
Mhtml message/rfc822
Mid audio/mid
Mny application/x-msmoney
Mov video/quicktime
Movie video/x-sgi-movie
Mp2 video/mpeg
Mp3 audio/mpeg
Mpa video/mpeg
Mpe video/mpeg
Mpeg video/mpeg
Mpg video/mpeg
Mpp application/vnd. ms-project
Mpv2 video/mpeg
Ms application/x-troff-ms
Mvb application/x-msmediaview
Nws message/rfc822
Oda application/oda
P10 application/pkcs10
P12 application/x-pkcs12
P7b application/x-pkcs7-certificates
P7c application/x-pkcs7-mime
P7m application/x-pkcs7-mime
P7r application/x-pkcs7-certreqresp
P7s application/x-pkcs7-signature
Pbm image/x-portable-bitmap
Pdf application/pdf
Pfx application/x-pkcs12
Pgm image/x-portable-graymap
Pko application/ynd. ms-pkipko
Pma application/x-perfmon
Pmc application/x-perfmon
Pml application/x-perfmon
Pmr application/x-perfmon
Pmw application/x-perfmon
Png image/x-png
Pnm image/x-portable-anymap
Pot, application/vnd. ms-powerpoint
Ppm image/x-portable-pixmap
Pps application/vnd. ms-powerpoint
Ppt application/vnd. ms-powerpoint
Prf application/pics-rules
Ps application/postscript
Pub application/x-mspublisher
Qt video/quicktime
Ra audio/x-pn-realaudio
Ram audio/x-pn-realaudio
Ras image/x-cmu-raster
Rgb image/x-rgb
Rmi audio/mid
Roff application/x-troff
Rtf application/rtf
Rtx text/richtext
Scd application/x-msschedule
Sct text/scriptlet
Setpay application/set-payment-initiation
Setreg application/set-registration-initiation
Sh application/x-sh
Shar application/x-shar
Sit application/x-stuffit
Snd audio/basic
Spc application/x-pkcs7-certificates
Spl application/futuresplash
Src application/x-wais-source
Sst application/vnd. ms-pkicertstore
Stl application/vnd. ms-pkistl
Stm text/html
Sv4cpio application/x-sv4cpio
Sv4crc application/x-sv4crc
T application/x-troff
Tar application/x-tar
Tcl application/x-tcl
Tex application/x-tex
Texi application/x-texinfo
Texinfo application/x-texinfo
Tgz application/x-compressed
Tif image/tiff
Tiff image/tiff
Tr application/x-troff
Trm application/x-msterminal
Tsv text/tab-separated-values
Txt text/plain
Uls text/iuls
Ustar application/x-ustar
Vcf text/x-vcard
Fig x-world/x-Fig
Wav audio/x-wav
Wcm application/vnd. ms-works
Wdb application/vnd. ms-works
Wks application/vnd. ms-works
Wmf application/x-msmetafile
Wps application/vnd. ms-works
Wri application/x-mswrite
Wrl x-world/x-Fig
Wrz x-world/x-Fig
Xaf x-world/x-Fig
Xbm image/x-xbitmap
Xla application/vnd. ms-excel
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
Xof x-world/x-Fig
Xpm image/x-xpixmap
Xwd image/x-xwindowdump
Z application/x-compress
Zip application/zip-firefox
Application/x-zip-compressed-IE


Php uploads compressed files (rar, 7z, zip)

Php uploads executable files (exe)

Php uploads video files, music files, and lyrics files (avi, rmvb, 3gp, flv, mp3, wav, krc, and lrc)

Php uploads text files and document files (word-> doc, excel-> xls, slides-> ppt, pdf, chm)

Php uploads database files (access files, SQL files, con files, log files, and dat files)

Php uploads webpage files, script files, and font files (ini, php, html, htm, and font files: ttf, fon, js, and xml)

Php uploads other files (class files, dll dynamic library files)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.