WordPress at a glance
function is not described


PHPMailer::filenameToType() public WP 1.0

Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.

{} It's a method of the class: PHPMailer{}

No Hooks.




$result = PHPMailer::filenameToType( $filename );
$filename(string) (required)
A file name or full path, does not need to exist as a file

Code of PHPMailer::filenameToType() WP 5.7.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);