| CFML Reference
|
|
ColdFusion Functions
|
ExpandPath
Description
Returns a path equivalent to the relative_path appended to the base template path. Note:
ExpandPath creates a platform-appropriate path. You can use a slash (/) or backslash (\) in a relative path.
- The return value contains a trailing slash (or backslash) if the relative path contains a trailing slash (or backslash).
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:
...
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|