Upload (upload files)

function Upload(what, toWhere: string): boolean

The Upload function upload the file(s) specified in the what parameter (wildcards are allowed) to the toWhere destination directory on the remote file server.

Attention

This function is not recursive, therefore when using wildcards, this function will not upload matching files from sub-directories of the directory specified in the what parameter. For a recursive version of this function see the UploadR function.

Example:

{
  var cli = new SftpClient();
  cli.Host = 'your.sftpserver.com:22';
  cli.User = 'someusername';
  cli.KeyFile = './my_id.rsa';
  if (cli.Connect()) {
    // ...
    if (cli.Upload('/docs/*.xlsx', '/dest/path')) {
      Log('file(s) uploaded');
    }
    // ...
    cli.Close();
  }
  cli = null
}