framework/utils/CFileHelper.php
public static function getMimeTypeByExtension($file,$magicFile=null)
	{
		static $extensions,$customExtensions=array();
		if($magicFile===null && $extensions===null)
			$extensions=require(Yii::getPathOfAlias('system.utils.mimeTypes').'.php');
		elseif($magicFile!==null && !isset($customExtensions[$magicFile]))
			$customExtensions[$magicFile]=require($magicFile);
		if(($ext=self::getExtension($file))!=='')
		{
			$ext=strtolower($ext);
			if($magicFile===null && isset($extensions[$ext]))
				return $extensions[$ext];
			elseif($magicFile!==null && isset($customExtensions[$magicFile][$ext]))
				return $customExtensions[$magicFile][$ext];
		}
		return null;
	}
public static function getMimeTypeByExtension($file,$magicFile=null)
	{
		static $extensions,$customExtensions=array();
		if($magicFile===null && $extensions===null)
			$extensions=require(Yii::getPathOfAlias('system.utils.mimeTypes').'.php');
		elseif($magicFile!==null && !isset($customExtensions[$magicFile]))
			$customExtensions[$magicFile]=require($magicFile);
		if(($ext=self::getExtension($file))!=='')
		{
			$ext=strtolower($ext);
			if($magicFile===null && isset($extensions[$ext]))
				return $extensions[$ext];
			elseif($magicFile!==null && isset($customExtensions[$magicFile][$ext]))
				return $customExtensions[$magicFile][$ext];
		}
		return null;
	}
public static function getMimeTypeByExtension ( $ file , $ magicFile = null ) { static $ extensions , $ customExtensions = array ( ) ; if ( $ magicFile === null && $ extensions === null ) $ extensions = require ( Yii :: getPathOfAlias ( 'system.utils.mimeTypes' ) . '.php' ) ; elseif ( $ magicFile !== null && ! isset ( $ customExtensions [ $ magicFile ] ) ) $ customExtensions [ $ magicFile ] = require ( $ magicFile ) ; if ( ( $ ext = self :: getExtension ( $ file ) ) !== '' ) { $ ext = strtolower ( $ ext ) ; if ( $ magicFile === null && isset ( $ extensions [ $ ext ] ) ) return $ extensions [ $ ext ] ; elseif ( $ magicFile !== null && isset ( $ customExtensions [ $ magicFile ] [ $ ext ] ) ) return $ customExtensions [ $ magicFile ] [ $ ext ] ; } return null ; }
Determines the MIME type based on the extension name of the specified file.
This method will use a local map between extension name and MIME type.
@param string $file the file name.
@param string $magicFile the path of the file that contains all available MIME type information.
If this is not set, the default 'system.utils.mimeTypes' file will be used.
This parameter has been available since version 1.1.3.
@return string the MIME type. Null is returned if the MIME type cannot be determined.
Determines the MIME type based on the extension name of the specified file . This method will use a local map between extension name and MIME type .