Upload file to FTP server
The “Upload file to FTP server” service task uploads a file to an FTP server. If the target folder does not exist yet, it is created automatically. Optionally you can overwrite the filename before uploading.
Input parameters
Provide the following fields as task input:
{
"FTPAccess": {
"host": "ftp.example.com",
"port": 21,
"user": "ftpUser",
"password": "ftpPassword"
},
"fileReference": "s3://bucket-name/path-to-file.pdf",
"filenameOverwrite": "uploaded_document.pdf",
"folder": "/target-folder"
}
Explanation:
FTPAccess
: Credentials for the FTP server including host name, port, username, and password.fileReference
: File reference (e.g., from an S3 bucket) that should be uploaded.filenameOverwrite
: Optional parameter to replace the original filename.folder
: Destination folder on the FTP server; created automatically if needed.
Output
The task returns a simple success result.
{
"success": true
}
Explanation:
success
: Indicates whether the upload to the FTP server was successful.
JSONata examples
Example expression for dynamic configuration:
{
"FTPAccess": {
"host": "ftp.example.com",
"port": 21,
"user": "{{$.credentials.ftpUser}}",
"password": "{{$.credentials.ftpPassword}}"
},
"fileReference": "{{$.attachments.invoice}}",
"filenameOverwrite": "Invoice_{{$.invoice.number}}.pdf",
"folder": "/invoices/{{$.invoice.year}}/{{$.invoice.month}}"
}
Notes
- Ensure the FTP credentials are correct.
- Missing target folders are created automatically.
- Use
filenameOverwrite
to adjust the filename as needed.
Tip
Test dynamic expressions in the JSONata Playground before using them in a process.