getFileMimeType(filePath)
Last updated July 19, 2005
Version: 1 | Requires: ColdFusion MX | Library: FileSysLib
Description:
Utilizes the getMimeType() method of the ServletContext object to determine the mime type of the specified file. Returns an empty string if the mime type of the file is unknown. The function takes one argument, the physical file path of the file.
Return Values:
Returns a string.
Example:
#getFileMimeType("C:\Inetpub\wwwroot\cfdocs\htmldocs\images\babelfi2.jpg")#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| filePath | The file to examine, | Yes |
Full UDF Source:
<!---
Returns the mime type of the specified file.
@param filePath The file to examine, (Required)
@return Returns a string.
@author Ben Rogers (ben@c4.net)
@version 1, July 19, 2005
--->
<cffunction name="getFileMimeType" returntype="string" output="no">
<cfargument name="filePath" type="string" required="yes">
<cfreturn getPageContext().getServletContext().getMimeType(arguments.filePath)>
</cffunction>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
11 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
30 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)