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