Skip to content

SSH.SFTPSession.Put

Andrew Lambert edited this page Nov 26, 2022 · 6 revisions

Method Signature

 Function Put(FileName As String, Overwrite As Boolean = False, Mode As Integer = &o744) As SSH.SSHStream
 Function Put(FileName As String, Upload As Readable, Overwrite As Boolean = False, Mode As Integer = &o744) As Boolean

Parameters

Put(String, Boolean, Integer)

Name Type Comment
FileName String The name to save the upload under on the server.
Overwrite Boolean Optional. If True then an existing file will be overwritten if it exists.
Mode Integer Optional. The Unix-style permissions to apply to the file.

Put(String, Readable, Boolean, Integer)

Name Type Comment
FileName String The name to save the upload under on the server.
Upload Readable The stream from which uploaded data will be read.
Overwrite Boolean Optional. If True then an existing file will be overwritten if it exists.
Mode Integer Optional. The Unix-style permissions to apply to the file.

Return value

Put(String, Boolean, Integer)

On success, returns an object that implements the SSHStream interface, from which the downloaded data can be read. On error returns Nil; check STFPSession.LastError for error details.

Put(String, Readable, Boolean, Integer)

Returns True if the file was uploaded successfully. Check STFPSession.LastError for error details if this method returns False.

Remarks

Uploads the file to the server using SFTP.

If the file already exists on the server and Overwrite=False then the operation will fail and SFTPSession.LastStatusCode will be LIBSSH2_FX_FILE_ALREADY_EXISTS(11). To append data to an existing file use the SFTPSession.Append method.

Clone this wiki locally