FTP task
Overview
The File Transfer Protocol (FTP) task in Deluge allows you to access and modify:
- files on an FTP server using upload and download operations.
- file data stored externally and bring it into your Zoho service.
Note:
- You can use this task to download files up to 5 MB.
- This task is currently not applicable in Zoho Flow.
Syntax
response = ftp [ action: action_type host: host_name port: port_number path: path_value files: file_name connection: connection_name ];
| Parameter | Data type | Description |
|---|---|---|
| <response> | KEY-VALUE / FILE / TEXT / LIST | The variable that will contain the response returned after the operation. |
| <action_type> | TEXT | The type of action that is to be performed in the server: Allowed Values: upload download |
| <host_name> | TEXT | The domain name of the FTP server. |
| <port_number> (Optional) | NUMBER | The value of the port of the server to be mentioned. Default port number: 21 |
| <path_value> | TEXT | The URL path of the service that needs to be accessed, excluding the base URL. For example, "/myftpserver.example.com". The path is necessary, especially for download actions. If no path is specified, the root directory will be considered as the destination folder. If a path is specified, then it must start with "/" . |
| <file_object> (optional) | TEXT | The file object to be uploaded. This is mandatory for upload. |
| <connection_name> (optional) | TEXT | The connection name configured to access the FTP server. |
Use Case
An organization maintains a set of standard reference files, such as compliance checklists, policy documents, or default templates, which are periodically updated and made available from a public URL. These files need to be uploaded to a centralized FTP server so that downstream systems and users can access them through a controlled location.
// Log initial step
info "FTP"; info "****"; // Fetch a text file from a public web URL ftpTxtFile = invokeurl [ url : "https://sample-files.com/downloads/documents/txt/simple.txt" type : GET ]; // Convert the content to a file object ftpTxtFile = ftpTxtFile.toFile("ftp.txt"); info ftpTxtFile; // Upload the file to the FTP server uploadFtp = ftp [ action : upload host : "ftp.examplehost.com" port : 21 path : "" files : ftpTxtFile connection : "ftp_connection" ]; info uploadFtp; // Download the same file from the FTP server downloadFtp = ftp [ action : download host : "ftp.examplehost.com" port : 21 path : "/ftp.txt" connection : "ftp_connection" ]; info downloadFtp; // Log the content of the downloaded file info downloadFtp.getFileContent();
Examples
Example 1: Upload File to FTP Server
The below script uploads a file to the FTP server.
// Upload file to FTP server uploadFtp = ftp [ action : upload host : "ftp.examplehost.com" port : 21 path : "/home/uploads/" files : textFile connection : "ftp_connection" ]; info uploadFtp;
Example 2: Download File from an FTP Server
The below script download a file from the FTP server.
// Download file from FTP server downloadFtp = ftp [ action : download host : "ftp.examplehost.com" port : 21 path : "/home/uploads/example.png" connection : "ftp_connection" ]; info downloadFtp;
Response Format
The standard response will be returned in the following format:
{
"responseText": "Example.png",
}The response for the request to return the response code will be in the following format:
{
File has been uploaded successfully
226
}
Troubleshooting for FTP server
1. Host unreachable or connection timeout
These errors occur when Deluge cannot connect to the FTP server during upload or download file operations.
Check host and port settings
Verify that the FTP host name and port number are correct (FTP uses port 21).
Check server accessibility
Confirm that the FTP server accepts external connections.
If IP restrictions are enabled, request the administrator to whitelist Zoho Creator’s outbound IP ranges.
Check connectivity tools
Test the server using an FTP client such as FileZilla or WinSCP to ensure it is active and reachable.
Check firewall and security rules
Ensure required ports are open and not blocked by firewalls or security tools.
2. Authentication Errors
These errors occur when the server is reachable but login fails.
Validate credentials
Confirm that the username and password match what is configured on the FTP server.
Check account status
Ensure the FTP user account is active and permitted to access the target directory.
Check special login restrictions
Ask your server administrator if additional login rules or IP-based constraints apply.
3. File Transfer Errors
These errors happen after login, during upload or download.
Check directory permissions
Verify that the FTP user has read/write access to the target directory.
Use complete paths
Always provide absolute paths (for example, /home/data/report.txt) instead of relative paths.
Validate folder existence
Ensure all directories referenced in the script already exist on the server.
Check naming and case sensitivity
Confirm the exact file and folder names, especially on Linux servers that enforce case sensitivity.