User Guide

344 Chapter 18 Interacting with Remote Servers
Assigning a cfftp connection to an Application variable could cause problems, since
multiple users could access the same connection object at the same time. Creating a
Session variable for a
cfftp connection makes more sense, because the connection
is available to only one client and does not last past the end of the session.
Example: Caching a connection
<cflock scope="Session" timeout=10>
<cfftp action="Open"
username="anonymous"
password="me@home.com"
server="ftp.eclipse.com"
connection="Session.myconnection">
</cflock>
In this example, the connection cache remains available to other pages within the
current session. You must enable Session variables in your application for this
approach to work, and you must lock code that uses Session variables. For
information on locking, see Locking Code with cflock on page 233.
Note
Changing a connections characteristics, such the retrycount or timeout values,
might require you to re-establish the connection.
Connection actions and attributes
The following table shows the available cfftp actions and the attributes they require
when you use a named (that is, cached) connection. If you do not specify an existing
connection name, you must specify the
username, password, and server attributes.
Action Attributes Action Attributes
Open none Rename existing
new
Close none Remove server
item
ChangeDir directory GetCurrentDir none
CreateDir directory GetCurrentURL none
ListDir name
directory
ExistsDir directory
RemoveDir directory ExistsFile remotefile
GetFile localfile
remotefile
Exists item
PutFile localfile
remotefile