Chapter 15: Interacting with Remote Servers
239
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
In order to use CFFTP, make sure CFOBJECT is enabled on the Basic
Security page of the ColdFusion Administrator.
For server/browser operations, use the CFFILE, CFCONTENT, and CFDIRECTORY
tags.
Note
CFFTP is a COM object and is not supported in Microsoft Windows NT
3.51.
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
USERNAME="betauser"
PASSWORD="monroe"
SERVER="beta.company.com"
ACTION="Open"
STOPONERROR="Yes">
<--- get current directory name --->
<CFFTP CONNECTION=FTP
ACTION="GetCurrentDir"
STOPONERROR="Yes">
<--- output directory name --->
<CFOUTPUT>
FTP directory listing of #cfftp.returnvalue#.<p>
</CFOUTPUT>
<--- get directory info --->
<CFFTP CONNECTION=FTP
ACTION="listdir"
DIRECTORY="/*."
NAME="q"
STOPONERROR="Yes">
<--- output dirlist results --->
<HR>
<P>FTP Directory Listing:</P>
<CFTABLE QUERY="q" HTMLTABLE>
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...