MACROMEDIA COLFUSION MX 7-CFML Reference page 602

Cfml reference
Hide thumbs Also See for COLFUSION MX 7-CFML:
Table of Contents

Advertisement

GetDirectoryFromPath
Description
Extracts a directory from an absolute path.
Returns
Absolute path, without the filename. The last character is a forward or backward slash, depending
on the operating system.
Category
System functions
Function syntax
GetDirectoryFromPath(path)
See also
,
ExpandPath
GetFileFromPath
Parameters
Parameter
path
Example
<h3>GetDirectoryFromPath 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:
<br>Here is a list of the other files in this directory:
<!--- use cfdirectory show directory, order by name & size --->
<cfdirectory directory = "#thisDirectory#"
name = "myDirectory" SORT = "name ASC, size DESC">
<!--- Output the contents of the cfdirectory as a CFTABLE --->
<cftable query = "myDirectory">
<cfcol header = "NAME:" text = "#Name#">
<cfcol header = "SIZE:" text = "#Size#">
</cftable>
</cfif>
</cfif>
<cfelse>
<H3>Please enter a file name</H3>
</cfif>
602
Chapter 3: ColdFusion Functions
Description
Absolute path (drive, directory, filename, and extension)

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents