How can I make sure that the supplied file - font(TrueType)? File path may be specified with custom extension(non .ttf
).
I'm confused.
How can I make sure that the supplied file - font(TrueType)? File path may be specified with custom extension(non .ttf
).
I'm confused.
Check this: finfo
For example:
$fileName = 'file.ext';
$mimeTypes = array('font/ttf','font/truetype');
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $fileName);
if(in_array($mime, $mimeTypes)){
echo 'font file';
}
finfo_close($finfo);
You must check FILEINFO_MIME_TYPE
.