FTP(E/S) client object

FtpsClient() // object constructor

This function creates and returns a new FtpsClient object, which is the AFT object that implements and carries out all file transfers and related operations using the FTP (plain), FTPS (implicit SSL/TLS), and FTPES (explicit SSL/TLS) protocols.

Here’s the protocol-specific properties that you may have to initialize/configure before calling the .Connect() method:

Host:               string
User:               string
Pass:               string
PassFromSecret:     string
TLS:                TLSMode // TLSNone || TLSExplicit || TLSImplicit
TrustInsecureCerts: bool

Host: is the IP address or HostName and Port of the remote file server. Should always be specified in the form IP:Port or Host:Port format. Examples: 192.168.2.23:21 or ftp.mycompany.com:21.

User: this is the username to access the remote server.

Pass: this is the password to access the remote server.

PassFromSecret: Syncplify.me AFT! allows you to store secrets (strings) in its encrypted database, so you don’t have to put them in clear in your scripts. If you have stored a host’s password (or APISecret) as an encrypted secret in Syncplify.me AFT! you can reference it via PassFromSecret to retrieve it at runtime without typing it in plain-text in your script. Read more about secrets.

TLS: this indicates whether or not you wish this client object to use SSL/TLS network encryption, and how. The possible values are:

  • TLSNone: indicates that no encryption will be used, data will be transferred in clear (not recommended)

  • TLSExplicit: this is the most common mode, the client object connects in clear, and immediately switches to TLS using the STARTTLS command (this is also the only TLS mode that’s actually a recognized standard)

  • TLSImplicit: assumes that the FTP server is listening on a SSL/TLS socket, so the connection will be established already encrypted (although this may sound more secure than TLSExplicit to the untrained ear, it actually isn’t even a recognized standard, but we do support it if you wish to use it)

TrustInsecureCerts: defaults to false, but you may set it to true if you want the client object to accept TLS certificates from servers that can’t be verified or that flat out fail verification; this is useful only when you know for sure that the FTP server is using a self-signed or otherwise invalid certificate but you are absolutely sure you can still trust it

Please, keep in mind that once created you (the programmer) have the responsibility of freeing the memory allocated by the object at the end of its use. You can easily do so by simply setting the object to null once you’re done using it (as shown in the example below).

Example:

{
  var cli = new FtpsClient();
  cli.Host = 'your.sftpserver.com:21';
  cli.User = 'someusername';
  cli.PassFromSecret = 'my_secret_name';
  cli.TLS = TLSExplicit;
  if (cli.Connect()) {
    // perform your file transfers...
    // ...
    // ...
    cli.Close();
  }
  cli = null
}