SocketTools .NET Edition

FtpClient.PutFile Method (String)

Upload a file from the local system to the server.

[Visual Basic]
Overloads Public Function PutFile( _
   ByVal localFile As String _
) As Boolean
[C#]
public bool PutFile(
   string localFile
);

Parameters

localFile
A string that specifies the file on the local system that will be transferred to the server. The file pathing and name conventions must be that of the local host.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The PutFile method copies an existing file from the local system to the server. This method will cause the current thread to block until the file transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

This implementation of the PutFile method is most commonly used when the name of the remote file has already been specified, either by setting the URL property or by explicitly setting the RemoteFile property.

See Also