protected function get_mimetype_from_filename($filename) {
        $mimetype = 'application/unknown';
        $types = core_filetypes::get_types();
        $fileextension = '.bin';
        if (strpos($filename, '.') !== false) {
            $fileextension = substr($filename, strrpos($filename, '.') + 1);
        }

        if (isset($types[$fileextension])) {
            $mimetype = $types[$fileextension]['type'];
        }
        return $mimetype;
    }
protected function get_mimetype_from_filename($filename) {
        $mimetype = 'application/unknown';
        $types = core_filetypes::get_types();
        $fileextension = '.bin';
        if (strpos($filename, '.') !== false) {
            $fileextension = substr($filename, strrpos($filename, '.') + 1);
        }

        if (isset($types[$fileextension])) {
            $mimetype = $types[$fileextension]['type'];
        }
        return $mimetype;
    }
protected function get_mimetype_from_filename ( $ filename ) { $ mimetype = 'application/unknown' ; $ types = core_filetypes :: get_types ( ) ; $ fileextension = '.bin' ; if ( strpos ( $ filename , '.' ) !== false ) { $ fileextension = substr ( $ filename , strrpos ( $ filename , '.' ) + 1 ) ; } if ( isset ( $ types [ $ fileextension ] ) ) { $ mimetype = $ types [ $ fileextension ] [ 'type' ] ; } return $ mimetype ; }
Given a filename, use the core_filetypes registered types to guess a mimetype.

If no mimetype is known, return 'application/unknown';

@param string $filename
@return string $mimetype
Given a filename use the core_filetypes registered types to guess a mimetype .