Class QMimeType
Class QMimeType: Helps determine MIME type of a file residing on the server
public static
string
|
#
GetMimeTypeForFile( string $strFilePath )
Returns the suggested MIME type for an actual file. Using file-based heuristics (data points in the ACTUAL file), it will utilize either the PECL FileInfo extension OR the Magic MIME extension (if either are available) to determine the MIME type. If all else fails, it will fall back to the basic GetMimeTypeForFilename() method. |
public static
string
|
#
GetMimeTypeForFilename( string $strFilename )
Returns the suggested MIME type for a filename by stripping out the extension and looking it up from QMimeType::$MimeTypeFor |
public static
string
|
#
GetTokenForMimeType( string $strMimeType )
To more easily process a file repository based on Mime Types, it's sometimes easier to tokenize a mimetype and process using the tokens (e.g. if you have a directory of image icons that you want to map back to a mime type or a collection of mime types, a tokenized-version of the mime type would be more appropriate). |
string |
_Default
Binary Data / Default |
#
'application/octet-stream'
|
string |
Executable
Binary data |
#
'application/octet-stream'
|
string |
Gif
GIF image |
#
'image/gif'
|
string |
Gzip
GZip archive |
#
'application/x-gzip'
|
string |
Html
HTML file |
#
'text/html'
|
string |
Jpeg
Image in JPEG/JPG format |
#
'image/jpeg'
|
string |
Mp3
MP3 audio |
#
'audio/mpeg'
|
string |
MpegVideo
MPEG Video |
#
'video/mpeg'
|
string |
MsExcel
Microsoft Office Excel file |
#
'application/vnd.ms-excel'
|
string |
MsPowerpoint
Microsoft Office Powerpoint file |
#
'application/vnd.ms-powerpoint'
|
string |
MsWord
Microsoft Office Word file |
#
'application/vnd.ms-word'
|
string |
OoXmlWordProcessing
OpenOfficeXml word processing file (e.g. LibreOffice writer file) |
#
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
string |
OoXmlPresentation
OpenOfficeXml presentation file (e.g. LibreOffice impress file) |
#
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
string |
OoXmlSpreadsheet
OpenOfficeXml spreadsheet file (e.g. LibreOffice calc file) |
#
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
string |
Pdf
PDF format document |
#
'application/pdf'
|
string |
PlainText
Plain text file |
#
'text/plain'
|
string |
Png
PNG format image |
#
'image/png'
|
string |
RichText
RTF document |
#
'text/rtf'
|
string |
Quicktime
QuickTime video |
#
'video/quicktime'
|
string |
WavAudio
Audio in WAV format |
#
'audio/x-wav'
|
string |
Xml
XML file |
#
'text/xml'
|
string |
Zip
Zip archive |
#
'application/x-zip'
|
public static
string[]
|
$MimeTypeFor
MimeTypeFor array is used in conjunction with GetMimeTypeForFilename() |
#
array(
'doc' => QMimeType::MsWord,
'docx' => QMimeType::OoXmlWordProcessing,
'exe' => QMimeType::Executable,
'gif' => QMimeType::Gif,
'gz' => QMimeType::Gzip,
'htm' => QMimeType::Html,
'html' => QMimeType::Html,
'jpeg' => QMimeType::Jpeg,
'jpg' => QMimeType::Jpeg,
'mov' => QMimeType::Quicktime,
'mp3' => QMimeType::Mp3,
'mpeg' => QMimeType::MpegVideo,
'mpg' => QMimeType::MpegVideo,
'pdf' => QMimeType::Pdf,
'php' => QMimeType::PlainText,
'png' => QMimeType::Png,
'ppt' => QMimeType::MsPowerpoint,
'pptx' => QMimeType::OoXmlPresentation,
'rtf' => QMimeType::RichText,
'sql' => QMimeType::PlainText,
'txt' => QMimeType::PlainText,
'wav' => QMimeType::WavAudio,
'xls' => QMimeType::MsExcel,
'xlsx' => QMimeType::OoXmlSpreadsheet,
'xml' => QMimeType::Xml,
'zip' => QMimeType::Zip
)
|
public static
string
|
$MagicDatabaseFilePath
the absolute file path of the MIME Magic Database file |
#
null
|