Hello,
Today I am facing a very strange problem while I was just checking
mime-type for uploaded files by my app users in PHP.
But it seems, none of the popular PHP functions are working.
Here it is I tried already.
// Solution # 1
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mtype = finfo_file($finfo, $tmpFile);
finfo_close($finfo);
if ($mtype == ("application/msword") ||
$mtype ==
("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
||
$mtype == ("application/pdf")
) {
return true;
} else {
return false;
}
//Solution # 2
$mimeArray = array(
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/pdf'
);
$mime = mime_content_type($tmpFile);
if (!in_array($mime, $mimeArray)) {
return false;
} else {
return true;
}
finfo_file, finfo_open, mime_content_type none of these functions are
working. So for PHP application running on GAE standard environment, what's
the most safest and easiest ways to detect file's mime-type in PHP?
Thanks in advance.
Regards,
Shaharia Azam
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/c53ac906-c787-496f-b732-c6e1ff71fe9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.