PHP 文件上传后缀名与文件类型对照表

PHP文件上传后缀名与文件类型对照表,我们经常上传文件,需要判断文档的类型,我们不能仅仅判断文件的后缀就可以了,为了安全我们还需要严格的判断文档类型,因为后缀是可以伪造的。

PHP 文件上传后缀名与文件类型对照表

IE浏览器

id后缀名php识别出的文件类型
0gifimage/gif
1jpgimage/jpeg
2pngimage/png
3bmpimage/bmp
4psdapplication/octet-stream
5icoimage/x-icon
6rarapplication/octet-stream
7zipapplication/zip
87zapplication/octet-stream
9exeapplication/octet-stream
10avivideo/avi
11rmvbapplication/vnd.rn-realmedia-vbr
123gpapplication/octet-stream
13flvapplication/octet-stream
14mp3audio/mpeg
15wavaudio/wav
16krcapplication/octet-stream
17lrcapplication/octet-stream
18txttext/plain
19docapplication/msword
20xlsapplication/vnd.ms-excel
21pptapplication/vnd.ms-powerpoint
22pdfapplication/pdf
23chmapplication/octet-stream
24mdbapplication/msaccess
25sqlapplication/octet-stream
26conapplication/octet-stream
27logtext/plain
28datapplication/octet-stream
29iniapplication/octet-stream
30phpapplication/octet-stream
31htmltext/html
32ttfapplication/octet-stream
33fonapplication/octet-stream
34jsapplication/x-javascript
35xmltext/xml
36dllapplication/octet-stream
37dllapplication/octet-stream

火狐浏览器

id后缀名php识别出的文件类型
0gifimage/gif
1jpgimage/pjpeg
2pngimage/x-png
3bmpimage/bmp
4psdapplication/octet-stream
5icoimage/x-icon
6rarapplication/octet-stream
7zipapplication/x-zip-compressed
87zapplication/octet-stream
9exeapplication/octet-stream
10avivideo/avi
11rmvbapplication/vnd.rn-realmedia-vbr
123gpapplication/octet-stream
13flvapplication/octet-stream
14mp3audio/mpeg
15wavaudio/wav
16krcapplication/octet-stream
17lrcapplication/octet-stream
18txttext/plain
19docapplication/msword
20xlsapplication/vnd.ms-excel
21pptapplication/vnd.ms-powerpoint
22pdfapplication/pdf
23chmapplication/octet-stream
24mdbapplication/msaccess
25sqltext/plain
26conapplication/octet-stream
27logtext/plain
28dattext/plain
29iniapplication/octet-stream
30phpapplication/octet-stream
31htmltext/html
32ttfapplication/octet-stream
33fonapplication/octet-stream
34jstext/html
35xmltext/xml
36dllapplication/octet-stream
37classapplication/java

以上是 PHP 文件上传后缀名与文件类型对照表 的全部内容, 来源链接: utcz.com/p/232307.html

回到顶部