SFTP Upload
SFTP Upload
Section titled “SFTP Upload”Type: sftp-upload · Package: SFTP Activities v1.1.0 · Output: string
Uploads a file from the robot’s machine to the SFTP server. To deliver results to an external system: send a batch of invoices, a generated report, an exchange file.
How it works
Section titled “How it works”Copies the file at localPath (robot’s machine) to remotePath (the server, including the file name):
- If a remote file with that name already exists, it is overwritten.
- The remote folder must exist: the activity does not create it. Prepare it with SFTP Create Directory.
- If the local file does not exist, it fails without touching the server.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
localPath | string | — | Path of the local file to upload. |
remotePath | string | — | Destination path on the server, with the file name (e.g. "/inbound/data.csv"). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanSftpSession | — | Session from SFTP Connect. Inherited inside a body. |
Output
Section titled “Output”Returns a string with the remote path of the uploaded file (the same value as remotePath). Since version 1.1.0 the Designer offers it as an output.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Local file not found. | localPath does not exist on the robot’s machine. Check the path or verify it first with File Exists. |
'localPath' is required. / 'remotePath' is required. | The parameter is missing or the expression returned null. |
'session' must be a ZoanSftpSession. | The activity is outside the SFTP Connect body and received no session. |
| Server error: path not found | The remotePath folder does not exist on the server. Create it with SFTP Create Directory. |
| Server error: permission denied | The user cannot write to that remote folder. |
Example
Section titled “Example”SFTP Connect host = "sftp.vendor.com" username = "zoan" password = credential("sftp-vendor")["password"] └─ body: SFTP Upload localPath = "C:/outbound/invoice_" + number + ".xml" remotePath = "/inbound/invoice_" + number + ".xml" SFTP Exists remotePath = "/inbound/invoice_" + number + ".xml" → output: uploaded Log message = uploaded ? "Invoice delivered" : "The invoice is not on the server"Related activities
Section titled “Related activities”- SFTP Download — the reverse operation.
- SFTP Exists / SFTP Create Directory — prepare the destination.