Chapter 15: Interacting with Remote Servers
Performing File Operations with CFFTP
The CFFTP tag allows you to perform tasks on remote servers via the File Transfer
Protocol (FTP). CFFTP allows you to cache connections for batch file transfers.
Note
For server/browser operations, use the CFFILE, CFCONTENT, and CFDIRECTORY
tags.
Note
Using CFFTP involves two distinct types of operations, connecting and transferring
files. For a complete list of attributes, see the CFML Language Reference .
To open an FTP connection and retrieve a file listing:
1.
Open a new file in Studio.
2.
Modify the file so that it appears as follows:
<--- open FTP connection --->
<CFFTP CONNECTION=FTP
<--- get current directory name --->
<CFFTP CONNECTION=FTP
<--- output directory name --->
<CFOUTPUT>
</CFOUTPUT>
<--- get directory info --->
<CFFTP CONNECTION=FTP
<--- output dirlist results --->
<HR>
<P>FTP Directory Listing:</P>
<CFTABLE QUERY="q" HTMLTABLE>
In order to use CFFTP, make sure CFOBJECT is enabled on the Basic
Security page of the ColdFusion Administrator.
CFFTP is a COM object and is not supported in Microsoft Windows NT
3.51.
USERNAME="betauser"
PASSWORD="monroe"
SERVER="beta.company.com"
ACTION="Open"
STOPONERROR="Yes">
ACTION="GetCurrentDir"
STOPONERROR="Yes">
FTP directory listing of #cfftp.returnvalue#.<p>
ACTION="listdir"
DIRECTORY="/*."
NAME="q"
STOPONERROR="Yes">
239
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?