我用这个代码来检查的图像类型检查上传的文件类型,如何在PHP
$f_type=$_FILES['fupload']['type'];
if ($f_type== "image/gif" OR $f_type== "image/png" OR $f_type== "image/jpeg" OR $f_type== "image/JPEG" OR $f_type== "image/PNG" OR $f_type== "image/GIF")
{
$error=False;
}
else
{
$error=True;
}
但一些用户抱怨在上载任何类型的图像,他们得到一个错误,而另一些人不要”没有任何错误!
我在想,如果这能解决问题:
if (mime_content_type($_FILES['fupload']['type']) == "image/gif"){...
有何评论?
错误!调用未定义的函数exif_imagetype() – John
我认为这个扩展没有在我的共享主机上启用:'extension = php_mbstring.dll extension = php_exif.dll' – John
@John尝试http://upgradephp.berlios.de然后,它提供了一个直接替换。 – deceze