ExpandPath

Description

Returns a path equivalent to the relative_path appended to the base template path. Note:

Category

System functions

Syntax

ExpandPath(relative_path) 

See also

FileExists, GetCurrentTemplatePath, GetFileFromPath

Parameters

Parameter
Description
relative_path
A relative path. ExpandPath converts a relative directory reference (.\ and ..\) to an absolute path. The function throws an error if this argument or the resulting absolute path is invalid.

Example

<!--- 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:
...