此文章由网友【上海-Yolanda】提供
以上一篇文章PHP上传文件代码及其$_FILES数组内容范例中$_FILES 数组的内容如下所示。我们假设文件上传字段的名称如上例所示,为
userfile。名称可随意命名。
$_FILES['userfile']['name']
客户端机器文件的原名称。
$_FILES['userfile']['type']
文件的 MIME 类型,如果浏览器提供此信息的话。一个例子是“image/gif”。不过此 MIME
类型在 PHP 端并不检查,因此不要想当然认为有这个值。
$_FILES['userfile']['size']
已上传文件的大小,单位为字节。
$_FILES['userfile']['tmp_name']
文件被上传后在服务端储存的临时文件名。
$_FILES['userfile']['error']
和该文件上传相关的错误代码。此项目是在 PHP 4.2.0版本中增加的。
php文件上传之文件类型对应表ie火狐各一份
ie
|
|
火狐
|
id
|
后缀名
|
php识别出的文件类型
|
id
|
后缀名
|
php识别出的文件类型
|
0
|
gif
|
image/gif
|
0
|
gif
|
image/gif
|
1
|
jpg
|
image/jpeg
|
1
|
jpg
|
image/pjpeg
|
2
|
png
|
image/png
|
2
|
png
|
image/x-png
|
3
|
bmp
|
image/bmp
|
3
|
bmp
|
image/bmp
|
4
|
psd
|
application/octet-stream
|
4
|
psd
|
application/octet-stream
|
5
|
ico
|
image/x-icon
|
5
|
ico
|
image/x-icon
|
6
|
rar
|
application/octet-stream
|
6
|
rar
|
application/octet-stream
|
7
|
zip
|
application/zip
|
7
|
zip
|
application/x-zip-compressed
|
8
|
7z
|
application/octet-stream
|
8
|
7z
|
application/octet-stream
|
9
|
exe
|
application/octet-stream
|
9
|
exe
|
application/octet-stream
|
10
|
avi
|
video/avi
|
10
|
avi
|
video/avi
|
11
|
rmvb
|
application/vnd.rn-realmedia-vbr
|
11
|
rmvb
|
application/vnd.rn-realmedia-vbr
|
12
|
3gp
|
application/octet-stream
|
12
|
3gp
|
application/octet-stream
|
13
|
flv
|
application/octet-stream
|
13
|
flv
|
application/octet-stream
|
14
|
mp3
|
audio/mpeg
|
14
|
mp3
|
audio/mpeg
|
15
|
wav
|
audio/wav
|
15
|
wav
|
audio/wav
|
16
|
krc
|
application/octet-stream
|
16
|
krc
|
application/octet-stream
|
17
|
lrc
|
application/octet-stream
|
17
|
lrc
|
application/octet-stream
|
18
|
txt
|
text/plain
|
18
|
txt
|
text/plain
|
19
|
doc
|
application/msword
|
19
|
doc
|
application/msword
|
20
|
xls
|
application/vnd.ms-excel
|
20
|
xls
|
application/vnd.ms-excel
|
21
|
ppt
|
application/vnd.ms-powerpoint
|
21
|
ppt
|
application/vnd.ms-powerpoint
|
22
|
pdf
|
application/pdf
|
22
|
pdf
|
application/pdf
|
23
|
chm
|
application/octet-stream
|
23
|
chm
|
application/octet-stream
|
24
|
mdb
|
application/msaccess
|
24
|
mdb
|
application/msaccess
|
25
|
sql
|
application/octet-stream
|
25
|
sql
|
text/plain
|
26
|
con
|
application/octet-stream
|
26
|
con
|
application/octet-stream
|
27
|
log
|
text/plain
|
27
|
log
|
text/plain
|
28
|
dat
|
application/octet-stream
|
28
|
dat
|
text/plain
|
29
|
ini
|
application/octet-stream
|
29
|
ini
|
application/octet-stream
|
30
|
php
|
application/octet-stream
|
30
|
php
|
application/octet-stream
|
31
|
html
|
text/html
|
31
|
html
|
text/html
|
32
|
htm
|
text/html
|
32
|
htm
|
text/html
|
33
|
ttf
|
application/octet-stream
|
33
|
ttf
|
application/octet-stream
|
34
|
fon
|
application/octet-stream
|
34
|
fon
|
application/octet-stream
|
35
|
js
|
application/x-javascript
|
35
|
js
|
text/html
|
36
|
xml
|
text/xml
|
36
|
xml
|
text/xml
|
37
|
dll
|
application/octet-stream
|
37
|
dll
|
application/octet-stream
|
38
|
class
|
application/octet-stream
|
38
|
class
|
application/java
|
如果您觉得本文的内容对您的学习有所帮助:
关键字:
PHP文件上传 文件类型对应表 PHP学习资料 PHP上传功能