我用PHP提交文件一个图片,上传后判断文件类型,IE 提交为什么格式为image/jpg?
我后台判断是image/jpeg和image/pjpeg我用IE为什么会有image/jpg格式,网上查了很多没找到
array(5) { ["name"]=> string(10) "982733.jpg" ["type"]=> string(9) "image/jpg" ["tmp_name"]=> string(25) "C:\WINDOWS\TEMP\php2E.tmp" ["error"]=> int(0) ["size"]=> int(19528) }
我后台判断是image/jpeg和image/pjpeg我用IE为什么会有image/jpg格式,网上查了很多没找到
array(5) { ["name"]=> string(10) "982733.jpg" ["type"]=> string(9) "image/jpg" ["tmp_name"]=> string(25) "C:\WINDOWS\TEMP\php2E.tmp" ["error"]=> int(0) ["size"]=> int(19528) }
IE6 [type] => image/pjpeg
FF3.0.7 [type] => image/jpeg
SARARI4.0.4 [type] => image/jpeg
GOOGLE 4.1.249 [type] => image/jpeg
OPERA 10.10 [type] => image/jpeg
要想检查图片类型,可以使用exif_imagetype或getimagesize函数
所以你应该自己来取定 mime
$info = getimagesize($_FILES['file']['tmp_name']);
$_FILES['type'] = $info['mime'];