There are a lot of PHP file upload class, File upload processing is a feature of PHP (at least the manual is to show this as a PHP feature, personally think that PHP in the array of outstanding features more features), Learning php people know how to do file upload, But many people in programming may have overlooked some of the details, which is the type of file (MIME). Before the form submits the file to PHP for processing, the browser resolves to identify what type of file is on one side, and then into the PHP process, and PHP will identify the original type of resolution of the file (not that you change to what suffix is the file). There will be some browser compatibility in this process, and more accurately, the file type resolution identity inconsistency problem. In this way, PHP processing post file types need to be based on different browsers to do more judgment, the most typical is the difference between IE and Firefox.
PHP Upload image file (Gif,jpg,bmp,png,psd,ico)
History of the most complete Oophper pro-beta php file upload file type corresponding table, ie, Firefox each.
Ie |
Firefox |
ID |
suffix name |
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 |
21st |
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 name |
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 |
21st |
Ppt |
Application/vnd.ms-powerpoint |
22 |
Pdf |
Application/pdf |
23 |
Chm |
Application/octet-stream |
24 |
Mdb |
Application/msaccess |
25 |
Qq. |
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/h323
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-VRML
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
Mans 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
VRML X-WORLD/X-VRML
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-VRML
Wrz X-WORLD/X-VRML
Xaf X-WORLD/X-VRML
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-VRML
XPM Image/x-xpixmap
XWD Image/x-xwindowdump
Z application/x-compress
Zip Application/zip-firefox
Application/x-zip-compressed-ie
PHP upload zip file (rar,7z,zip)
PHP upload executable file (EXE)
PHP upload video files, music files, lyrics files (AVI,RMVB,3GP,FLV,MP3,WAV,KRC,LRC)
PHP upload text file and document file (Word->doc,excel->xls, slide->ppt,pdf,chm)
PHP Upload database files (access files, SQL files, con files, log file logs, DAT files)
PHP upload Web page files, script files, font files (ini,php,html,htm, font files: Ttf,fon, JS, XML)
PHP Upload Other files (class class file, DLL dynamic loading library file)