PHPMailer\PHPMailer
PHPMailer::filenameToType
Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
Method of the class: PHPMailer{}
No Hooks.
Returns
String.
Usage
$result = PHPMailer::filenameToType( $filename );
- $filename(string) (required)
- A file name or full path, does not need to exist as a file.
PHPMailer::filenameToType() PHPMailer::filenameToType code WP 7.0
public static function filenameToType($filename)
{
//In case the path is a URL, strip any query string before getting extension
$qpos = strpos($filename, '?');
if (false !== $qpos) {
$filename = substr($filename, 0, $qpos);
}
$ext = static::mb_pathinfo($filename, PATHINFO_EXTENSION);
return static::_mime_types($ext);
}