Upload File to FTP Server

Sends a file to a server using the FTP or SFTP protocol.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

ftpUpload --file(String) --type(FtpType) --host(String) [--useanonymous(Boolean)] [--useprivatekeyauthentication(Boolean)] --sftpusername(String) [--ftpusername(String)] [--password(String)] --remotepath(String) --privatekeyfile(String) (Boolean)=value

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
File Name file Required Text Full path of the file to upload.
Type type Required FtpType Type of protocol to be used: FTP or SFTP.

Both protocols are used to transfer files from one computer to another, but SFTP requires an SSH server connection. Encrypted FTP connections (FTPS) are not supported.
Host server path host Required Text Server connection URI.
Anonymous connection useranonymous Optional Boolean Enable to hide the username, establishing an anonymous connection.
Use private key authentication useprivatekeyauthentication Optional Boolean Enable to enter the path to the private key file.
SFTP username sftpusername Only when Type is SFTP Text Username to access the server via SFTP.
FTP username ftpusername Optional Text Username to access the server via FTP.
Password password Optional Text User password to access the server via FTP.
Remote Path remotepath Required Text Path of the directory to save the file in the server.
Note:Do to not include the filename on the path.
Private key file privatekeyfile Only when Use private key authentication is True Text Path to the private key file.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Success value Boolean Returns True if the file was uploaded successfully. Otherwise, returns False.


In the following example, see how to send a file to a server via FTP.

defVar --name sucess --type Boolean
ftpUpload --type "Ftp" --host hostAddress --username userName --password password --remotepath filePath --file fileName sucesso=value
Remember:For this example to work properly, it is necessary to use a valid host, with valid username and password for access.