Chapter 1: ColdFusion Tags
CFFTP Query Object Columns (Continued)
Column
Attributes
IsDirectory
Connection Caching
Once you've established a connection with CFFTP, you can reuse the connection to
perform additional FTP operations. To do this, you use the CONNECTION attribute to
define and name an FTP connection object that stores information about the
connection. Any additional FTP operations that use the same CONNECTION name
automatically make use of the information stored in the connection object. This
facility helps save connection time and drastically improves file transfer operation
performance.
If you need to keep the connection open throughout a session or longer, you can use a
session or application variable as the connection name. However, if you do this, you
must explicitly specify the full variable name with the Close action when you are
finished. Note that keeping a connection open prevents others from using the FTP
server; therefore, you should close the connection as soon as possible.
Note
Example
The following example opens an FTP connection, retrieves a file listing, showing file or
directory name, path, URL, length, and modification date. Connection caching is used
to maintain the link to the server, and automatic error checking is enabled.
<CFFTP CONNECTION=FTP
USERNAME="betauser"
PASSWORD="monroe"
SERVER="beta.company.com"
ACTION="Open"
STOPONERROR="Yes">
<CFFTP CONNECTION=FTP
ACTION="GetCurrentDir"
STOPONERROR="Yes">
<CFOUTPUT>
FTP directory listing of #cfftp.returnvalue#.<P>
</CFOUTPUT>
<CFOUTPUT>Return is #cfftp.returnvalue#</CFOUTPUT><BR>
Description
String indicating attributes of the current element
Boolean value indicating whether object is a file
or directory
Changes to a cached connection, such as changing RETRYCOUNT or
TIMEOUT values, may require reestablishing the connection.
71
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?
Questions and answers