1
我有一些PHP代码检查用户上传的文件类型:PHP +允许上传JPG文件
$fileType = $_FILES['file']['type'];
$allowedFileTypes = array('image/jpeg','image/gif','image/png','image/jpg');
if(!in_array($fileType, $allowedFileTypes)) {echo 'fileTypeNotAllowed'; exit;}
我发现GIF & PNG文件上传不触发回声但JPG文件引发的回声。
下面是触发回声文件的例子:
上,我做错了什么在这里任何建议?
THX
echo $ fileType上传JPEG时看到它说什么 –
也许你的代码不会允许海滩照片 – Tchoupi
$ fileType包含什么? 'echo'fileTypeNotAllowed:'。$ fileType;' –