Performing File Operations With Cfftp - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Performing file operations with cfftp

The
tag lets you perform tasks on remote servers using File Transfer Protocol (FTP). You
cfftp
can use
to cache connections for batch file transfers when uploading or downloading files.
cfftp
Note: To use cfftp, the Enable cfftp Tag option must be selected on the Tag Restrictions page of
the Basic Security section of the ColdFusion MX Administrator Security tab.
For server/browser operations, use the
Using
involves two major types of operations: connecting, and transferring files. The FTP
cfftp
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
tag, see CFML Reference.
To open an FTP connection and retrieve a file listing:
Create a ColdFusion page with the following content:
1
<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:
</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#">
,
, and
cffile
cfcontent
#cfftp.returnvalue#<p>

Performing file operations with cfftp

tags.
cfdirectory
cfftp
815

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion mx

Table of Contents