Skip to content

FTPClient » Upload

Upload a local file to the a location in the remote ftp server. Returns true if the upload was successful or false otherwise.

js
client.Upload(localPath, remotePath);
client.Upload(localPath, remotePath);

Parameters

  • localPath - The file to upload.
  • remotePath- The remote path where the file will be uploaded.

Example

js
let client = ftp.Connect(
    "sftp", 
    "example.domain.com", 
    22, 
    "brad", 
    "password"
); 

if (client.IsConnected()) { 
    let result = client.Upload('MyFile.txt', '/remote/path'); 
    console.log("Uploading file result: " + result);
}
let client = ftp.Connect(
    "sftp", 
    "example.domain.com", 
    22, 
    "brad", 
    "password"
); 

if (client.IsConnected()) { 
    let result = client.Upload('MyFile.txt', '/remote/path'); 
    console.log("Uploading file result: " + result);
}