PHPMailer\PHPMailer

PHPMailer::filenameToType()public staticWP 1.0

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.

Return

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() code WP 6.6.2

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);
}