Mime
in package
OBSOLETE -- See {@see Filetype.class.php}
Tags
Table of Contents
Properties
- $arrExtensions2MimeTypes : array<string|int, mixed>
- Known extensions and corresponding MIME types.
- $strDefaultType : string
- The default MIME type used if nothing is known about the data
Methods
- getDefaultType() : string
- Return the default MIME type
- getMimeTypeForExtension() : string
- Return the MIME type for the extension provided.
- getTypeMenuoptions() : string
- Returns the HTML code for the MIME type dropdown menu
- isKnownExtension() : bool
- Returns boolean true if the string argument is a known ending, false otherwise.
Properties
$arrExtensions2MimeTypes
Known extensions and corresponding MIME types.
private
static array<string|int, mixed>
$arrExtensions2MimeTypes
= array('3dm' => 'x-world/x-3dmf', '3dmf' => 'x-world/x-3dmf', 'ai' => 'application/postscript', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'au' => 'audio/basic', 'avi' => 'video/x-msvideo', 'bin' => 'application/octet-stream', 'cab' => 'application/x-shockwave-flash', 'chm' => 'application/mshelp', 'class' => 'application/octet-stream', 'com' => 'application/octet-stream', 'csh' => 'application/x-csh', 'css' => 'text/css', 'csv' => 'text/comma-separated-values', 'dll' => 'application/octet-stream', 'doc' => 'application/msword', 'dot' => 'application/msword', 'eps' => 'application/postscript', 'exe' => 'application/octet-stream', 'fh4' => 'image/x-freehand', 'fh5' => 'image/x-freehand', 'fhc' => 'image/x-freehand', 'fif' => 'image/fif', 'gif' => 'image/gif', 'gtar' => 'application/x-gtar', 'gz ' => 'application/gzip', 'hlp' => 'application/mshelp', 'hqx' => 'application/mac-binhex40', 'htm' => 'text/html', 'html' => 'text/html', 'ico' => 'image/x-icon', 'ief' => 'image/ief', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'js' => 'application/x-javascript', 'js' => 'text/javascript', 'latex' => 'application/x-latex', 'mcf' => 'image/vasa', 'mid' => 'audio/x-midi', 'midi' => 'audio/x-midi', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/x-mpeg', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'pbm' => 'image/x-portable-bitmap', 'pdf' => 'application/pdf', 'pgm' => 'image/x-portable-graymap', 'php' => 'application/x-httpd-php', 'phtml' => 'application/x-httpd-php', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'pot' => 'application/mspowerpoint', 'ppm' => 'image/x-portable-pixmap', 'pps' => 'application/mspowerpoint', 'ppt' => 'application/mspowerpoint', 'ppz' => 'application/mspowerpoint', 'ps' => 'application/postscript', 'qd3' => 'x-world/x-3dmf', 'qd3d' => 'x-world/x-3dmf', 'qt' => 'video/quicktime', 'ra' => 'audio/x-pn-realaudio', 'ram' => 'audio/x-pn-realaudio', 'rgb' => 'image/x-rgb', 'rpm' => 'audio/x-pn-realaudio-plugin', 'rtf' => 'text/rtf', 'rtx' => 'text/richtext', 'sgm' => 'text/x-sgml', 'sgml' => 'text/x-sgml', 'sh' => 'application/x-sh', 'shtml' => 'text/html', 'sit' => 'application/x-stuffit', 'snd' => 'audio/basic', 'stream' => 'audio/x-qt-stream', 'swf' => 'application/x-shockwave-flash', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'tsv' => 'text/tab-separated-values', 'txt' => 'text/plain', 'viv' => 'video/vnd.vivo', 'vivo' => 'video/vnd.vivo', 'wav' => 'audio/x-wav', 'wbmp' => 'image/vnd.wap.wbmp', 'webp' => 'image/webp', 'wml' => 'text/vnd.wap.wml', 'wrl' => 'model/vrml', 'xbm' => 'image/x-xbitmap', 'xhtml' => 'application/xhtml+xml', 'xla' => 'application/msexcel', 'xls' => 'application/msexcel', 'xml' => 'text/xml', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-windowdump', 'z' => 'application/x-compress', 'zip' => 'application/zip')
Note that these associations are arbitrary!
Tags
$strDefaultType
The default MIME type used if nothing is known about the data
private
static string
$strDefaultType
= 'application/octet-stream'
Tags
Methods
getDefaultType()
Return the default MIME type
public
static getDefaultType() : string
Tags
Return values
string —The default MIME type
getMimeTypeForExtension()
Return the MIME type for the extension provided.
public
static getMimeTypeForExtension(string $strExtension) : string
Takes a full file name, or a file extension with or without the dot as an argument, i.e. 'cloudrexx.zip', '.gif, or 'txt'. Returns the string 'application/octet-stream' for any unknown ending. Use to test exactly that.
Parameters
- $strExtension : string
-
The file extension
Tags
Return values
string —The corresponding MIME type
getTypeMenuoptions()
Returns the HTML code for the MIME type dropdown menu
public
static getTypeMenuoptions([string $selected = '' ]) : string
Parameters
- $selected : string = ''
-
The optional selected MIME tpye
Tags
Return values
string —The menu options HTML code
isKnownExtension()
Returns boolean true if the string argument is a known ending, false otherwise.
public
static isKnownExtension(string $strExtension) : bool
Parameters
- $strExtension : string
-
The file extension
Tags
Return values
bool —True if the extension is known, false otherwise