Filesystem.php
public static function getMimeType(string $file, bool $guess = true)
    {
        // Get mime using the file information functions
        if (function_exists('finfo_open')) {
            $info = finfo_open(FILEINFO_MIME_TYPE);

            $mime = finfo_file($info, $file);

            finfo_close($info);

            return $mime;

        } else {

            // Just guess mime by using the file extension
            if ($guess === true) {
                $mime_types = Filesystem::$mime_types;

                $extension = pathinfo($file, PATHINFO_EXTENSION);

                return isset($mime_types[$extension]) ? $mime_types[$extension] : false;
            } else {
                return false;
            }
        }
    }
public static function getMimeType(string $file, bool $guess = true)
    {
        // Get mime using the file information functions
        if (function_exists('finfo_open')) {
            $info = finfo_open(FILEINFO_MIME_TYPE);

            $mime = finfo_file($info, $file);

            finfo_close($info);

            return $mime;

        } else {

            // Just guess mime by using the file extension
            if ($guess === true) {
                $mime_types = Filesystem::$mime_types;

                $extension = pathinfo($file, PATHINFO_EXTENSION);

                return isset($mime_types[$extension]) ? $mime_types[$extension] : false;
            } else {
                return false;
            }
        }
    }
public static function getMimeType ( string $ file , bool $ guess = true ) { // Get mime using the file information functions if ( function_exists ( 'finfo_open' ) ) { $ info = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mime = finfo_file ( $ info , $ file ) ; finfo_close ( $ info ) ; return $ mime ; } else { // Just guess mime by using the file extension if ( $ guess === true ) { $ mime_types = Filesystem :: $ mime_types ; $ extension = pathinfo ( $ file , PATHINFO_EXTENSION ) ; return isset ( $ mime_types [ $ extension ] ) ? $ mime_types [ $ extension ] : false ; } else { return false ; } } }
Returns the mime type of a file. Returns false if the mime type is not found.

@param  string  $file  Full path to the file
@param  bool    $guess Set to false to disable mime type guessing
@return mixed
Returns the mime type of a file . Returns false if the mime type is not found .