Answer the question
In order to leave comments, you need to log in
PHP $_FILES[filename][type], mime type trustworthy?
At me files at loading through the form are checked on mime type the list of resolved types.
1 So is it worth believing this information?
The fact is that the finfo extension does not correctly give the mime type, mp4 mp3 file.
$info = finfo_open(FILEINFO_MIME_TYPE, $magicFile);
if ($info) {
$result = finfo_file($info, $file);
finfo_close($info);
if ($result !== false) {
return $result;
}
}
Answer the question
In order to leave comments, you need to log in
Since PHP >= 5.3.11 and >= 5.4.1 the magic database format has changed. As a consequence, the internal mime database has also been updated. This especially affects the code where the external magic base is read. Reading old format magic files will not work. Some textual representations of mime types have also been changed, for example PHP will return "PHP script, ASCII text" instead of "PHP script text".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question