Adobe COLDFUSION 9 Manual page 1246

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using External Resources
<html>
<head>
<title>FTP Test</title>
</head>
<body>
<h1>FTP Test</h1>
<!--- Open ftp connection --->
<cfftp connection="Myftp"
server="MyServer"
username="MyUserName"
password="MyPassword"
action="Open"
stoponerror="Yes">
<!--- Get the current directory name. --->
<cfftp connection=Myftp
action="GetCurrentDir"
stoponerror="Yes">
<!--- output directory name --->
<cfoutput>
The current directory is:#cfftp.returnvalue#<p>
</cfoutput>
<!--- Get a listing of the directory. --->
<cfftp connection=Myftp
action="listdir"
directory="#cfftp.returnvalue#"
name="dirlist"
stoponerror="Yes">
<!--- Close the connection.--->
<cfftp action="close" connection="Myftp">
<p>Did the connection close successfully?
<cfoutput>#cfftp.succeeded#</cfoutput></p>
<!--- output dirlist results --->
<hr>
<p>FTP Directory Listing:</p>
<cftable query="dirlist" colheaders="yes" htmltable>
<cfcol header="<B>Name</b>" TEXT="#name#">
<cfcol header="<B>Path</b>" TEXT="#path#">
<cfcol header="<B>URL</b>" TEXT="#url#">
<cfcol header="<B>Length</b>" TEXT="#length#">
<cfcol header="<B>LastModified</b>"
TEXT="#DateFormat(lastmodified)#">
<cfcol header="<B>IsDirectory</b>"
TEXT="#isdirectory#">
</cftable>
2
Change
to the name of a server for which you have FTP permission.
MyServer
Change
and
3
MyUserName
To establish an anonymous connection, enter "anonymous" as the user name and an e-mail address (by
convention) for the password.
to a valid user name and password.
MyPassword
Last updated 8/5/2010
1241

Advertisement

Table of Contents
loading

Table of Contents