<cfftp>
Lets users implement File Transfer Protocol (FTP) operations.
This tag cannot have a body.
This tag is also supported within <cfscript>
<cfftp
action=copy|exists|existsFile|existsDir|open|close|changeDir|createDir|getCurrentDir|getCurrentUrl|listDir|removeDir|getFile|putFile|quote|rename|remove
username=string
password=string
server=string
timeout=number
port=number
connection=string
proxyServer=string
proxyPort=number
proxyUser=string
proxyPassword=string
retryCount=number
stopOnError=boolean
passive=boolean
name=string
directory=string
ASCIIExtensionList=string
transferMode=string
remoteFile=string
localFile=string
failIfExists=boolean
existing=string
new=string
item=string
result=string
fingerprint=string
secure=string
recurse=boolean
key=string
passphrase=string
actionParam=string
>
| Attribute | Description |
|---|---|
|
action
string, required
|
edit
the FTP action to be executed
|
|
recurse
boolean, optional
|
edit
delete content of the directory Alias: recursive |
|
actionParam
string, optional
|
edit
used with action="quote" to execute custom ftp commands |
Open Connection
action="open" - Open persistent FTP connection
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
server
string, optional
|
edit
The Server to connect |
|
username
string, optional
|
edit
The Username for the connection |
|
password
string, optional
|
edit
The Password for the connection |
|
port
number, optional
|
edit
server port of the connection |
|
timeout
number, optional
|
edit
timeout for the connection |
|
retryCount
number, optional
|
edit
retry count |
|
passive
boolean, optional
|
edit
enable passive mode |
|
transferMode
string, optional
|
edit
|
|
stopOnError
boolean, optional
|
edit
define if execution halt on error or not |
|
secure
string, optional
|
edit
Secure connection (sftp|shh) or not. |
|
key
string, optional
|
edit
the ssh private key |
|
passphrase
string, optional
|
edit
the passphrase that protects ssh private key |
|
fingerprint
string, optional
|
edit
the ssh fingerprint |
|
proxyServer
string, optional
|
edit
Host name or IP address of a proxy server. |
|
proxyPort
number, optional
|
edit
The port number on the proxy server from which the object is requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document. |
|
proxyUser
string, optional
|
edit
When required by a proxy server, a valid username. |
|
proxyPassword
string, optional
|
edit
When required by a proxy server, a valid password. |
Close Connection
action="close" - Close FTP connection
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
Download File
action="getFile" - Download file from FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
remoteFile
string, optional
|
edit
File on the Server |
|
localFile
string, optional
|
edit
File on the current machine |
|
failIfExists
boolean, optional
|
edit
throw an error if local file already exist or overwrite it |
|
transferMode
string, optional
|
edit
|
|
ASCIIExtensionList
string, optional
|
edit
Delimited list of file extensions that force ASCII transfer mode, if transferMode = "auto". |
Upload File
action="putFile" - Upload file to FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
remoteFile
string, optional
|
edit
File on the Server |
|
localFile
string, optional
|
edit
File on the current machine |
|
transferMode
string, optional
|
edit
|
|
ASCIIExtensionList
string, optional
|
edit
Delimited list of file extensions that force ASCII transfer mode, if transferMode = "auto". |
List Directory
action="listDir" - List contents of FTP directory
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
directory
string, optional
|
edit
remote directory to list |
|
name
string, optional
|
edit
name of the query for list directory Alias: variable |
Create Directory
action="createDir" - Create directory on FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
directory
string, optional
|
edit
remote directory to list |
Remove Directory
action="removeDir" - Remove directory from FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
directory
string, optional
|
edit
remote directory to list |
Change Directory
action="changeDir" - Change current directory on FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
directory
string, optional
|
edit
remote directory to list |
Get Current Directory
action="getCurrentDir" - Get current working directory path
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
result
string, optional
|
edit
Name of the result value (default:cfftp) |
Get Current URL
action="getCurrentUrl" - Get current working directory as URL
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
result
string, optional
|
edit
Name of the result value (default:cfftp) |
Check Exists
action="exists" - Check if file or directory exists
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
item
string, optional
|
edit
item on the server |
|
result
string, optional
|
edit
Name of the result value (default:cfftp) |
Check File Exists
action="existsFile" - Check if file exists
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
remoteFile
string, optional
|
edit
File on the Server |
|
result
string, optional
|
edit
Name of the result value (default:cfftp) |
Check Directory Exists
action="existsDir" - Check if directory exists
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
directory
string, optional
|
edit
remote directory to list |
|
result
string, optional
|
edit
Name of the result value (default:cfftp) |
Rename File/Directory
action="rename" - Rename file or directory on FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
existing
string, optional
|
edit
source or existing file or directory to rename |
|
new
string, optional
|
edit
new name for file or directory |
Remove File
action="remove" - Remove file from FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
item
string, optional
|
edit
item on the server |
Copy File
action="copy" - Copy file on FTP server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
|
existing
string, optional
|
edit
source or existing file or directory to rename |
|
new
string, optional
|
edit
new name for file or directory |
Send Raw FTP Command
action="quote" - Send raw FTP command to server
| Attribute | Description |
|---|---|
|
connection
string, optional
|
edit
the name for the connection, used to cache the connection within the current request |
Usage Notes
editLucee 7.0.0.233 adds support for low level debugging
LUCEE_FTP_DEBUG=trueenables debug logging to the console for FTPLUCEE_JSCH_DEBUG=trueenables debug logging to the console for SFTP
Examples
editFTP action open
<cfftp action="open" username="#FTPusername#" password="#FTPpassword#" server="#FTPserver#" port="#FTPPort#" connection="#connection_name#"/>
FTP action close
<cfftp action="close" connection="#connection_name#"/>
FTP action listDir
<cfftp action="listDir" connection="#connection_name#" name="test" directory="/"/>
FTP action createDir
<cfftp action="createDir" connection="#connection_name#" directory="directoryName"/>
FTP action removeDir
<cfftp action="removeDir" username="#FTPusername#" password="#FTPpassword#" server="#FTPserver#" port="#FTPPort#" directory="directoryName"/>
FTP action existsFile
<cfftp action="existsFile" username="#FTPusername#" password="#FTPpassword#" server="#FTPserver#" port="#FTPPort#" remotefile="FileName"/>
FTP action putFile
<cfftp action="putFile" username="#FTPusername#" password="#FTPpassword#" server="#FTPserver#" port="#FTPPort#" remotefile="FileName" localFile="FileName"/>
FTP action existsDir
<cfftp action="existsDir" username="#FTPusername#" password="#FTPpassword#" server="#FTPserver#" port="#FTPPort#" directory="directoryName" />
Related System Properties / Environment Variables
- LUCEE_FTP_DEBUG - Boolean which enables debug logging to the console for FTP
Type: boolean, Default: false - LUCEE_JSCH_DEBUG - Boolean which enables debug logging to the console for SFTP
Type: boolean, Default: false
See also
- Internet Protocols
- <cfhttp>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)