Try
-
print($_FILES['whateverYouCalledIt']['type'];
-
exit;
-
To see why it's not matching.
[EDIT: Incidentally, if you made the array keys the accepted types, your script would execute a tiny bit faster as it could use a reference instead of have to loop through the entire array to find a matching MIME type.
E.g.:
-
$mimetypes = array
-
(
-
'image/tiff', => true,
-
'image/vnd.adobe.photoshop', => true,
-
'image/jpeg', => true,
-
'image/png', => true
-
);
-
-
if(! $mimetypes[$_FILES['whateverYouCalledIt']['type']]) {
-
header('Location: somepage.php?message=MIME_TYPE_MISMATCH');
-
exit;
-
}
-
The other advantage of doing this is that if you wanted to temporarily disable support for a particular mime-type, you could just set its value to false instead of deleting it or commenting it out).
]