Upload File to FTP Server

Verb: ftpUpload

Avaliable from: <Standard>

Sends a file to a server using the FTP (File Transfer Protocol) or SFTP (Secure File Transfer Protocol) protocol.

The FTP and SFTP protocols make it possible to transfer files between computers via the network.

Syntax

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

Inputs

Script Designer Required AcceptedTypes Description
--file File Name Required Text Name of the file that should be saved.
--type Type Required FtpType Type of protocol that should be used:
  • Ftp
  • Sftp
  • FTP and SFTP transfer the file from one computer to another, however, FTP does not provide a secure channel for transferring files, while SFTP offers extra protection for files, for example, using the SSH (Secure Shell) security protocol.
    --host Host server path Required Text Path of the server where the file will be sent.
    --useanonymous Anonymous connection Optional Boolean When enabled, it hides the username, establishing an anonymous connection.
    --useprivatekeyauthentication Use private key authentication Optional Boolean When enabled, it makes the field available to inform the path of the private key file.
    --sftpusername SFTP username Only when Type is Sftp Text Username to access the server via SFTP.
    --ftpusername FTP username Optional Text Username to access the server via FTP.
    --password Password Optional Text User password to access the server via FTP.
    --remotepath Remote Path Required Text Path on the server where the file to be saved.
    --privatekeyfile Private key file Only when Use private key authentication is True Text Path to the private key file.

    Outputs

    Script Designer AcceptedTypes Description
    value Success Boolean Returns True if the file was uploaded or False otherwise.

    Example

    In the following example, a simulation of how to send a file to a server using the FTP protocol is performed.

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

    See Also

  • Delete File from FTP Server
  • Download FTP Server File
  • List FTP Server Directories