php 文件上传后缀名与文件类型对照表(几乎涵盖所有文件)

前端之家收集整理的这篇文章主要介绍了php 文件上传后缀名与文件类型对照表(几乎涵盖所有文件)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

网上有很多PHP文件上传的类,文件上传处理是PHP的一个特色(至少手册上是将此作为PHP特点来展示的,个人认为PHP在数组方面的优异功能更有特色),学PHP的人都知道文件上传怎么做,但很多人在编程中却可能忽视了一些细节问题,那就是文件的类型(MIME)。在表单将文件提交给PHP做处理之前,浏览器会先解析识别一边是什么类型的文件,之后进入PHP处理环节,PHP又会去识别解析此文件的原始类型(并不是说你改成什么后缀就是什么文件)。在这个过程中会有一些浏览器兼容,更准确来说是文件类型解析标识不一致的问题。这样在PHP处理Post过来的文件类型时就需要根据不同浏览器做更多的判断,最典型的就是IE和火狐下的区别。   PHP上传图片文件(gif,jpg,bmp,png,psd,ico) 史上最完全ooPHPer亲测版PHP文件上传文件类型对应表,ie,火狐各一份。

ie 火狐
id@H_403_14@ 后缀名@H_403_14@ PHP识别出的文件类型@H_403_14@
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@H_403_14@ 后缀名@H_403_14@ PHP识别出的文件类型@H_403_14@
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 //应用程序 @H_404_668@323 text/h323 @H_404_668@acx application/internet-property-stream @H_404_668@ai application/postscript @H_404_668@aif audio/x-aiff @H_404_668@aifc audio/x-aiff @H_404_668@aiff audio/x-aiff @H_404_668@asf video/x-ms-asf @H_404_668@asr video/x-ms-asf @H_404_668@asx video/x-ms-asf @H_404_668@au audio/basic @H_404_668@avi video/x-msvideo @H_404_668@axs application/olescript @H_404_668@bas text/plain @H_404_668@bcpio application/x-bcpio @H_404_668@bin application/octet-stream @H_404_668@bmp image/bmp @H_404_668@c text/plain @H_404_668@cat application/vnd.ms-pkiseccat @H_404_668@cdf application/x-cdf @H_404_668@cer application/x-x509-ca-cert @H_404_668@class application/octet-stream @H_404_668@clp application/x-msclip @H_404_668@cmx image/x-cmx @H_404_668@cod image/cis-cod @H_404_668@cpio application/x-cpio @H_404_668@crd application/x-mscardfile @H_404_668@crl application/pkix-crl @H_404_668@crt application/x-x509-ca-cert @H_404_668@csh application/x-csh @H_404_668@css text/css @H_404_668@dcr application/x-director @H_404_668@der application/x-x509-ca-cert @H_404_668@dir application/x-director @H_404_668@dll application/x-msdownload @H_404_668@dms application/octet-stream @H_404_668@doc application/msword @H_404_668@dot application/msword @H_404_668@dvi application/x-dvi @H_404_668@dxr application/x-director @H_404_668@eps application/postscript @H_404_668@etx text/x-setext @H_404_668@evy application/envoy @H_404_668@exe application/octet-stream @H_404_668@fif application/fractals @H_404_668@flr x-world/x-vrml @H_404_668@gif image/gif @H_404_668@gtar application/x-gtar @H_404_668@gz application/x-gzip @H_404_668@h text/plain @H_404_668@hdf application/x-hdf @H_404_668@hlp application/winhlp @H_404_668@hqx application/mac-binhex40 @H_404_668@hta application/hta @H_404_668@htc text/x-component @H_404_668@htm text/html @H_404_668@html text/html @H_404_668@htt text/webviewhtml @H_404_668@ico image/x-icon @H_404_668@ief image/ief @H_404_668@iii application/x-iphone @H_404_668@ins application/x-internet-signup @H_404_668@isp application/x-internet-signup @H_404_668@jfif image/pipeg @H_404_668@jpe image/jpeg @H_404_668@jpeg image/jpeg @H_404_668@jpg image/jpeg @H_404_668@jpg image/pjpeg @H_404_668@js application/x-javascript @H_404_668@latex application/x-latex @H_404_668@lha application/octet-stream @H_404_668@lsf video/x-la-asf @H_404_668@lsx video/x-la-asf @H_404_668@lzh application/octet-stream @H_404_668@m13 application/x-msmediaview @H_404_668@m14 application/x-msmediaview @H_404_668@m3u audio/x-mpegurl @H_404_668@man application/x-troff-man @H_404_668@mdb application/x-msaccess @H_404_668@me application/x-troff-me @H_404_668@mht message/rfc822 @H_404_668@mhtml message/rfc822 @H_404_668@mid audio/mid @H_404_668@mny application/x-msmoney @H_404_668@mov video/quicktime @H_404_668@movie video/x-sgi-movie @H_404_668@mp2 video/mpeg @H_404_668@mp3 audio/mpeg @H_404_668@mpa video/mpeg @H_404_668@mpe video/mpeg @H_404_668@mpeg video/mpeg @H_404_668@mpg video/mpeg @H_404_668@mpp application/vnd.ms-project @H_404_668@mpv2 video/mpeg @H_404_668@ms application/x-troff-ms @H_404_668@mvb application/x-msmediaview @H_404_668@nws message/rfc822 @H_404_668@oda application/oda @H_404_668@p10 application/pkcs10 @H_404_668@p12 application/x-pkcs12 @H_404_668@p7b application/x-pkcs7-certificates @H_404_668@p7c application/x-pkcs7-mime @H_404_668@p7m application/x-pkcs7-mime @H_404_668@p7r application/x-pkcs7-certreqresp @H_404_668@p7s application/x-pkcs7-signature @H_404_668@pbm image/x-portable-bitmap @H_404_668@pdf application/pdf @H_404_668@pfx application/x-pkcs12 @H_404_668@pgm image/x-portable-graymap @H_404_668@pko application/ynd.ms-pkipko @H_404_668@pma application/x-perfmon @H_404_668@pmc application/x-perfmon @H_404_668@pml application/x-perfmon @H_404_668@pmr application/x-perfmon @H_404_668@pmw application/x-perfmon @H_404_668@png image/x-png @H_404_668@pnm image/x-portable-anymap @H_404_668@pot,application/vnd.ms-powerpoint @H_404_668@ppm image/x-portable-pixmap @H_404_668@pps application/vnd.ms-powerpoint @H_404_668@ppt application/vnd.ms-powerpoint @H_404_668@prf application/pics-rules @H_404_668@ps application/postscript @H_404_668@pub application/x-mspublisher @H_404_668@qt video/quicktime @H_404_668@ra audio/x-pn-realaudio @H_404_668@ram audio/x-pn-realaudio @H_404_668@ras image/x-cmu-raster @H_404_668@rgb image/x-rgb @H_404_668@rmi audio/mid @H_404_668@roff application/x-troff @H_404_668@rtf application/rtf @H_404_668@rtx text/richtext @H_404_668@scd application/x-msschedule @H_404_668@sct text/scriptlet @H_404_668@setpay application/set-payment-initiation @H_404_668@setreg application/set-registration-initiation @H_404_668@sh application/x-sh @H_404_668@shar application/x-shar @H_404_668@sit application/x-stuffit @H_404_668@snd audio/basic @H_404_668@spc application/x-pkcs7-certificates @H_404_668@spl application/futuresplash @H_404_668@src application/x-wais-source @H_404_668@sst application/vnd.ms-pkicertstore @H_404_668@stl application/vnd.ms-pkistl @H_404_668@stm text/html @H_404_668@sv4cpio application/x-sv4cpio @H_404_668@sv4crc application/x-sv4crc @H_404_668@t application/x-troff @H_404_668@tar application/x-tar @H_404_668@tcl application/x-tcl @H_404_668@tex application/x-tex @H_404_668@texi application/x-texinfo @H_404_668@texinfo application/x-texinfo @H_404_668@tgz application/x-compressed @H_404_668@tif image/tiff @H_404_668@tiff image/tiff @H_404_668@tr application/x-troff @H_404_668@trm application/x-msterminal @H_404_668@tsv text/tab-separated-values @H_404_668@txt text/plain @H_404_668@uls text/iuls @H_404_668@ustar application/x-ustar @H_404_668@vcf text/x-vcard @H_404_668@vrml x-world/x-vrml @H_404_668@wav audio/x-wav @H_404_668@wcm application/vnd.ms-works @H_404_668@wdb application/vnd.ms-works @H_404_668@wks application/vnd.ms-works @H_404_668@wmf application/x-msMetafile @H_404_668@wps application/vnd.ms-works @H_404_668@wri application/x-mswrite @H_404_668@wrl x-world/x-vrml @H_404_668@wrz x-world/x-vrml @H_404_668@xaf x-world/x-vrml @H_404_668@xbm image/x-xbitmap @H_404_668@xla application/vnd.ms-excel @H_404_668@xlc application/vnd.ms-excel @H_404_668@xlm application/vnd.ms-excel @H_404_668@xls application/vnd.ms-excel @H_404_668@xlt application/vnd.ms-excel @H_404_668@xlw application/vnd.ms-excel @H_404_668@xof x-world/x-vrml @H_404_668@xpm image/x-xpixmap @H_404_668@xwd image/x-xwindowdump @H_404_668@z application/x-compress @H_404_668@zip application/zip -firefox @H_404_668@application/x-zip-compressed -IE @H_404_668@  PHP上传压缩文件(rar,7z,zip)   PHP上传可执行文件(exe)   PHP上传视频文件,音乐文件,歌词文件(avi,rmvb,3gp,flv,mp3,wav,krc,lrc)   PHP上传文本文件和文档文件(word->doc,excel->xls,幻灯片->ppt,pdf,chm)   PHP上传数据库文件(access文件,sql文件,con文件,日志文件log,dat文件)   PHP上传网页文件,脚本文件,字体文件(ini,PHP,html,htm,字体文件:ttf,fon,js,xml)   PHP上传其他文件(class类文件,dll动态加载库文件)

猜你在找的PHP相关文章