Back to product page

PutFile method


Uploads file to the server.

Type

Void

Syntax

  • C#
  • VB.NET
public Void PutFile();

public Void PutFile(Stream FromStream);
The PutFile(FromStream) syntax has these parts:
FromStreamPath on the server where file should be stored.

public Void PutFile(String LocalFile);
The PutFile(LocalFile) syntax has these parts:
LocalFileFull path to file on local computer.

public Void PutFile(Stream FromStream, String RemoteFile);
The PutFile(FromStream,RemoteFile) syntax has these parts:
FromStreamPath on the server where file should be stored.
RemoteFilePath on the server where file should be stored.

public Void PutFile(String LocalFile, String RemotePath);
The PutFile(LocalFile,RemotePath) syntax has these parts:
LocalFileFull path to file on local computer.
RemotePathPath on the server where file should be stored.

public Sub PutFile()

public Sub PutFile(ByVal FromStream As Stream)
The PutFile(FromStream) syntax has these parts:
FromStreamPath on the server where file should be stored.

public Sub PutFile(ByVal LocalFile As String)
The PutFile(LocalFile) syntax has these parts:
LocalFileFull path to file on local computer.

public Sub PutFile(ByVal FromStream As Stream, ByVal RemoteFile As String)
The PutFile(FromStream,RemoteFile) syntax has these parts:
FromStreamPath on the server where file should be stored.
RemoteFilePath on the server where file should be stored.

public Sub PutFile(ByVal LocalFile As String, ByVal RemotePath As String)
The PutFile(LocalFile,RemotePath) syntax has these parts:
LocalFileFull path to file on local computer.
RemotePathPath on the server where file should be stored.

Remarks

PutFile method will initiate copying of file residing on local computer to remote server you connected to. During the transfer, Progress event will be fired several times, depending on your network speed and length of the file. When the copying is completed, Done event will be fired.

If an error occurs during transfer, Done event will be fired immediately containing ErrorCode and description for the error, and transfer will be aborted. If you want to continue it later, or resend the file, initiate PutFile method again (immediately or after reconnecting, depends on error that occurred). You may also use Resume property to resume transferring from the position where the error occurred.

This method can be initiated only when State property is set to Connected. You cannot send file if wodSFTP.NET is busy doing something else.

Although LocalFile argument MUST contain full path including filename of the file you wish to send, RemotePath can omit filename. For instance, you can set RemotePath = "/tmp" in which case wodSFTP.NET will automatically copy it with the same name as it is locally. If you wish to specify that is copied with some other name, you have to include it in RemotePath argument.

If you don't specify LocalFile or RemotePath argument, wodSFTP.NET will use values set in LocalPath and RemotePath properties.

No wildcards can be used for RemotePath argument. RFC protocol specification for SFTP does not allow them.

Platforms

Windows