I’m using this code to get the MIME from the file header:
$fileInfo = new \finfo(FILEINFO_MIME);
$mimeType = $fileInfo->buffer(file_get_contents($_FILES[$formVar]['tmp_name']));
However, this could be a memory hog on large files as it reads the entire file into a string. I can easily truncate this but how many characters would you truncate it to to check a file header?
Ah yeah, didn’t know about that function! Thanks, I’ve just tested it and the memory used shows that it definitely just reads the header. Thanks a long, simple elegant solution!