I found that instead I get the correct mime type:
$finfo = new finfo(FILEINFO_MIME_TYPE); $mimeType = $finfo->file($_FILES['uploadName']['tmp_name'][$key]);
And as Martin said in the comment above:
You should not grab the MIME type from the data specified in $ _FILE, as it is very flaky and for interpretation, as you are going through. Instead, do a new analysis of the loaded temporary file, use finfo () or similar.
source share