我用这段代码来检查图像的类型,
$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;
}
Run Code Online (Sandbox Code Playgroud)
但有些用户抱怨他们在上传任何类型的图片时出错,而其他一些用户则没有收到任何错误!
我想知道这是否解决了这个问题:
if (mime_content_type($_FILES['fupload']['type']) == "image/gif"){...
任何意见?