get_mime_by_extension()

get_mime_by_extension($filename)

Parameters:
  • $filename (string) – File name
Returns:

MIME type string or FALSE on failure

Return type:

string

Translates a filename extension into a MIME type based on config/mimes.php. Returns FALSE if it can’t determine the type, or read the MIME config file.

$file = 'somefile.png';
echo $file.' is has a mime type of '.get_mime_by_extension($file);

Note

This is not an accurate way of determining file MIME types, and is here strictly for convenience. It should not be used for security purposes.

doc_CodeIgniter
2016-10-15 16:32:23
Comments
Leave a Comment

Please login to continue.