src/Common/Util/FileToolkit.php
public static function guessExtensionForLocalFile($file_path, $fallback_extension = '')
    {
        // FILEINFO_MIME would return the mime encoding as well
        $finfo = new finfo(FILEINFO_MIME_TYPE);
        $mime_type = $finfo->file($file_path);

        return static::guessExtensionByMimeType($mime_type, $fallback_extension);
    }
public static function guessExtensionForLocalFile($file_path, $fallback_extension = '')
    {
        // FILEINFO_MIME would return the mime encoding as well
        $finfo = new finfo(FILEINFO_MIME_TYPE);
        $mime_type = $finfo->file($file_path);

        return static::guessExtensionByMimeType($mime_type, $fallback_extension);
    }
public static function guessExtensionForLocalFile ( $ file_path , $ fallback_extension = '' ) { // FILEINFO_MIME would return the mime encoding as well $ finfo = new finfo ( FILEINFO_MIME_TYPE ) ; $ mime_type = $ finfo -> file ( $ file_path ) ; return static :: guessExtensionByMimeType ( $ mime_type , $ fallback_extension ) ; }
Returns a file extension guessed for the given local file.

@param string $file_path path to file
@param string $fallback_extension extension to return on failed guess

@return string default file extension for given mime type or fallback extension provided
Returns a file extension guessed for the given local file .