- ⌂ mime_type
- Static Methods
mime_type::get_extension_from_mime_type()
Get the file extension of a file format based on the corresponding MIME Type.
Prototype
string get_extension_from_mime_type(string $mime_type)
Parameters
- mime_type - A two-part MIME Type string, such as 'application/pdf'.
Return
A string containing the file extension, in all lowercase, and without the dot. For example, "pdf".
Example
// print the file extension for the PDF MIME Type
$mime_type = 'application/pdf';
$ext = \io_comand_util\mime_type::get_extension_from_mime_type($mime_type);
echo("File extension for MIME Type $mime_type is $ext");