User Guide

Table Of Contents
Performing file operations with cfftp 999
<cfoutput>
Response Mime Type: #cfhttp.MimeType#<br>
Response Length: #len(cfhttp.filecontent)# <br>
Response Content: <br>
#htmlcodeformat(cfhttp.filecontent)#<br>
</cfoutput>
Performing file operations with cfftp
The cfftp tag lets you perform tasks on remote servers using File Transfer Protocol (FTP). You
can use
cfftp to cache connections for batch file transfers when uploading or downloading files.
Note: To use cfftp, you must select the Enable ColdFusion Security option on the Sandbox Security
page in the Security area in the ColdFusion MX Administrator. (In the Standard Edition, select
Security > Basic Security.)
For server/browser operations, use the cffile, cfcontent, and cfdirectory tags.
Using
cfftp involves two major types of operations: connecting, and transferring files. The FTP
protocol also provides commands for listing directories and performing other operations. For a
complete list of attributes that support FTP operations and additional details on using the
cfftp
tag, see CFML Reference.
To open an FTP connection and retrieve a file listing:
1.
Create a ColdFusion page with the following content:
<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#"