public static function mimetype($fullpath, $filename = null) {
        if (empty($filename)) {
            $filename = $fullpath;
        }

        // The mimeinfo function determines the mimetype purely based on the file extension.
        $type = mimeinfo('type', $filename);

        if ($type === 'document/unknown') {
            // The type is unknown. Inspect the file now.
            $type = self::mimetype_from_file($fullpath);
        }
        return $type;
    }
public static function mimetype($fullpath, $filename = null) {
        if (empty($filename)) {
            $filename = $fullpath;
        }

        // The mimeinfo function determines the mimetype purely based on the file extension.
        $type = mimeinfo('type', $filename);

        if ($type === 'document/unknown') {
            // The type is unknown. Inspect the file now.
            $type = self::mimetype_from_file($fullpath);
        }
        return $type;
    }
public static function mimetype ( $ fullpath , $ filename = null ) { if ( empty ( $ filename ) ) { $ filename = $ fullpath ; } // The mimeinfo function determines the mimetype purely based on the file extension. $ type = mimeinfo ( 'type' , $ filename ) ; if ( $ type === 'document/unknown' ) { // The type is unknown. Inspect the file now. $ type = self :: mimetype_from_file ( $ fullpath ) ; } return $ type ; }
Return mimetype by given file pathname.

If file has a known extension, we return the mimetype based on extension.
Otherwise (when possible) we try to get the mimetype from file contents.

@param string $fullpath Full path to the file on disk
@param string $filename Correct file name with extension, if omitted will be taken from $path
@return string
Return mimetype by given file pathname .