getMimeType() public static method
Determines the MIME type of the specified file.
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 getMimeTypeByExtension() when $checkExtension is true.
| public static string getMimeType ( $file, $magicFile = null, $checkExtension = true ) | ||
|---|---|---|
| $file | string |
The file name. |
| $magicFile | string |
Name of the optional magic database file (or alias), usually something like |
| $checkExtension | boolean |
Whether to use the file extension to determine the MIME type in case |
| return | string |
The MIME type (e.g. |
| throws | yii\base\InvalidConfigException |
when the |
Please login to continue.