ColdFusion - How to get a file name from an absolute path

GetFileFromPath() - get a file name from an absolute path

GetFileFromPath.cfm


<!DOCTYPE html">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GetFileFromPath function example: how to get a file name from an absolute path</title>
</head>

<body>
<h2 style="color:Crimson">GetFileFromPath Function Example</h2>

<cfset CurrentTemplatePath=GetCurrenttemplatePath()>
<cfset CurrentTemplate=GetFileFromPath(CurrentTemplatePath)>

<cfoutput>
<b>Current Template Path:</b> #CurrentTemplatePath#
<br />
<b>Current Template(File) Name:</b> #CurrentTemplate#
</cfoutput>
</body>
</html>





More ColdFusion examples