CFLib.org – Common Function Library Project

getFileMimeType(filePath)

Last updated July 19, 2005

author

Ben Rogers

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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson