我上傳了tif文件,但我總是收到echo'上傳的文件類型不受支持'。爲什麼? 我如何檢查文件是否是按照我的支持的文件如何檢查上傳的文件是否是受支持的文件
//image types supported
$types = array(IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_TIFF);
list($width, $height, $type) = getimagesize($_FILES[$name]['tmp_name']);
$ext = image_type_to_extension($type); // get the extension
if (!isset($types[$type])) {
echo = 'The uploaded file type is not supported';
} else
echo = 'All good!';
}
是做到了!謝謝...只是改正了錯誤:if(!in_array($ type,$ types)){...} – Marco
@Marco不客氣 – Musa