我使用了这段代码来检查图片的类型:
$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"){...
有什么评论吗?
extension=php_mbstring.dll extension=php_exif.dll
。 - John$_FILES
中不同字段的含义:https://www.php.net/manual/en/features.file-upload.post-method.php。`tmp_name`是正确的。 - deceze$photoData = MSGraph::getUserProfilePic($username); $photoType = SomeMagicMaetadataFunction($photoData);
如果有任何指引,将不胜感激,否则我将需要进行二进制十六进制编码,并学习一些文件格式并编写一个尝试手动解析我的关键情况的函数。 - TampaCraig