Miscellaneous
mimeTypes()
Signature
Section titled “Signature”mimeTypes() — returns any
Description
Section titled “Description”Returns an associated MIME type based on a file extension.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
extension | string | yes | — | The extension to get the MIME type for. |
fallback | string | yes | application/octet-stream | The fallback MIME type to return. |
Examples
Section titled “Examples”mimeTypes(extension [, fallback ]) <!--- Get the internally-stored MIME type for `xls` --->
<cfset mimeType = mimeTypes("xls")>
<!--- Get the internally-stored MIME type for a dynamic value. Fall back to a MIME type of `text/plain` if it's not found --->
<cfset mimeType = mimeTypes(extension=params.type, fallback="text/plain")>