Skip to content

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.

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.
ParameterTypeDefaultDescription
localPathstring—Path of the local file to upload.
remotePathstring—Destination path on the server, with the file name (e.g. "/inbound/data.csv").
ParameterTypeDefaultDescription
sessionZoanSftpSession—Session from SFTP Connect. Inherited inside a body.

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.

MessageCause 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 foundThe remotePath folder does not exist on the server. Create it with SFTP Create Directory.
Server error: permission deniedThe user cannot write to that remote folder.
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"