getFileMimeType(filePath)
Last updated July 20, 2005
Version: 1 | Requires: CF6 | 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:
<cfoutput>
#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
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016