This method will first try to determine the MIME type based on
finfo_open. If the fileinfo extension is not installed,
it will fall back to BaseFileHelper::getMimeTypeByExtension when $checkExtension is true.
public static getMimeType ( string $file, string $magicFile = null, boolean $checkExtension = true ) : string | ||
$file | string | the file name. |
$magicFile | string | name of the optional magic database file (or alias), usually something like `/path/to/magic.mime`. This will be passed as the second parameter to [finfo_open()](http://php.net/manual/en/function.finfo-open.php) when the `fileinfo` extension is installed. If the MIME type is being determined based via [[getMimeTypeByExtension()]] and this is null, it will use the file specified by [[mimeMagicFile]]. |
$checkExtension | boolean | whether to use the file extension to determine the MIME type in case `finfo_open()` cannot determine it. |
return | string | the MIME type (e.g. `text/plain`). Null is returned if the MIME type cannot be determined. |