MIME::extForType

Return the preferred file extension for a specified MIME type

Synopsis

uses('mime');

public static function MIME::extForType(string [in] $type)

Description

MIME::extForType() returns the preferred file extension, if any, for a given MIME type. For example, the preferred extension string for the text/plain type is .txt. If a file extension mapping exists, it will be returned with a leading dot. If no file extension mapping exists, an empty string will be returned.

Example

Parameters

Name Direction Type Description
$type in string The MIME type to resolve to an extension

Return Value

string The preferred file extension for $type, or an empty string if no mapping exists.