core/classes/FileHelper.class.php
public function getMimeType($file){

        if(function_exists('finfo_open')) {
            $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
            $info = finfo_open($const);
            if($info && ($result = finfo_file($info,$file,$const)) !== false){
                finfo_close($info);
                return $result;
            }//if
        }//if

        if(function_exists('mime_content_type') && ($result = mime_content_type($file)) !== false) {
            return $result;
        }//if

    }
public function getMimeType($file){

        if(function_exists('finfo_open')) {
            $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
            $info = finfo_open($const);
            if($info && ($result = finfo_file($info,$file,$const)) !== false){
                finfo_close($info);
                return $result;
            }//if
        }//if

        if(function_exists('mime_content_type') && ($result = mime_content_type($file)) !== false) {
            return $result;
        }//if

    }
public function getMimeType ( $ file ) { if ( function_exists ( 'finfo_open' ) ) { $ const = defined ( 'FILEINFO_MIME_TYPE' ) ? FILEINFO_MIME_TYPE : FILEINFO_MIME ; $ info = finfo_open ( $ const ) ; if ( $ info && ( $ result = finfo_file ( $ info , $ file , $ const ) ) !== false ) { finfo_close ( $ info ) ; return $ result ; } //if } //if if ( function_exists ( 'mime_content_type' ) && ( $ result = mime_content_type ( $ file ) ) !== false ) { return $ result ; } //if }
Get a file type based on the file MIME info.


@param string $file The file.

@return string The type.
Get a file type based on the file MIME info .