wodSFTP API library - PutFile Method
      
 

Description

Sends a file to the server.


Return type
A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

long Sftp_PutFile(void *Sftp, char *LocalFile, char *RemotePath);

The PutFile function syntax has these parts:

Part Description
void *Sftp Handle of the created Sftp instance.
char *LocalFile Full path to a file on local computer.
char *RemotePath Full path to a file/directory on the server.

Remarks

The PutFile function will initiate copying of a file from the local computer to the remote server that you are connected to. During the transfer, the Progress callback will be called several times, depending on your network connection speed and the size of the file. When the copy is complete, the Done callback will be invoked.

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

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

Although the LocalFile argument MUST contain the full path including the filename of the file you wish to send, you can omit the RemotePath argument. For instance, you can set:

RemotePath = "/tmp"

in which case wodSFTP will automatically copy it using the same name that it has locally. If you want to copy it with another name, you should include the name in the RemotePath argument.

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

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