GetFileFromPath

Extracts the filename from a fully specified path.

See also ExpandPath and GetDirectoryFromPath.

Syntax

GetFileFromPath(path)
path

Fully qualified path (drive, directory, filename, and extension).

Examples

<!--- This example shows the use of GetFileFromPath--->
<HTML>
<HEAD>
<TITLE>
GetFileFromPath Example
</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<H3>GetFileFromPath Example</H3>

<p>This is a read-only example. Because file access is a sensitive area,
consider the security of your directory hierarchy prior to allowing
access to it.</p>

<!---<CFSET thisPath=ExpandPath("*.*")>
<CFSET thisDirectory=GetDirectoryFromPath(thisPath)>
<CFOUTPUT>
The current directory is: #GetDirectoryFromPath(thisPath)#
<CFIF IsDefined("form.yourFile")>
    <CFIF form.yourFile is not "">
        <CFSET yourFile=form.yourFile>
            <CFIF FileExists(ExpandPath(yourfile))>
            <P>Your file exists in this directory.  You entered
            the correct file name, #GetFileFromPath("#thisPath#/
#yourfile#")#
            <CFELSE>
            <P>Your file was not found in this directory:
            </CFIF>
    </CFIF>
<CFELSE>
<H3>Please enter a file name</H3>
</CFIF>
</CFOUTPUT>

<FORM action="getfilefrompathe.cfm" METHOD="post">
<H3>Enter the name of a file in this directory <I><FONT SIZE="-1">(try 
expandpath.cfm)</FONT></I></H3>
<INPUT TYPE="Text" NAME="yourFile">
<INPUT TYPE="Submit" NAME="">
</FORM> --->
 
</BODY>
</HTML>