fix getMimeType

This commit is contained in:
2019-02-22 21:16:09 +01:00
parent 18bfde08d3
commit fdb634764c

View File

@@ -127,6 +127,7 @@ class ToolBox
public static function getMimeType($sPath, $bSubTypeOnly=false)
{
$sMimetype = '';
//Retrieving file Content Type
if(file_exists($sPath)) //Local
{
@@ -152,7 +153,7 @@ class ToolBox
if($bSubTypeOnly)
{
preg_match('`\/(?P<type>\w+)(\;|$)`ui', mb_strtolower($sMimetype), $asMatch);
$sMimetype = $asMatch['type'];
if(array_key_exists('type', $asMatch)) $sMimetype = $asMatch['type'];
}
return $sMimetype;
}