Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
Chapter 2:  ColdFusion Functions
345
ExpandPath
Returns a path equivalent to the relative_path appended to the base template path. 
Note the following:
ExpandPath creates a platform-appropriate path. You can use either a slash (/) 
or a back slash (\) in the specified relative path.
The return value contains a trailing slash (or back slash) if the specified relative 
path contains a trailing slash (or back slash).
See also 
FileExists
GetCurrentTemplatePath
, and 
GetFileFromPath
.
Syntax
ExpandPath(
relative_path)
relative_path
Any relative path. ExpandPath converts relative directory references (.\ and ..\)to 
an absolute path. The function throws an error if this argument or the resulting 
absolute path is invalid.
Examples
<!--- This example shows the use of ExpandPath --->
<HTML>
<HEAD>
<TITLE>
ExpandPath Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>ExpandPath Example</H3>
<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:
...