我有这个片段
if ($_FILES['tax']['error'] !== UPLOAD_ERR_OK) {
die("Upload failed with error " . $_FILES['tax']['error']);
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $_FILES['tax']['tmp_name']);
$ok = false;
switch ($mime) {
case 'image/gif':
case 'application/pdf':
case 'image/png':
$ok = true;
default:
die("Unknown/not permitted file type");
}
move_uploaded_file($_FILES["tax"]["tmp_name"],"pints/" . $_FILES["tax"]["name"]);
当我尝试上传图像时,它指出它不是允许的文件类型,当文件是 PDF 文档时,application/pdf
mime 类型是否正确?