Uploading, downloading and deletion of files is all done through simple method calls on the FTPConnection class.
Uploading Files
Uploading of a file is done by the following method-call:
ftpConnection.UploadFile(localFilePath, remoteFileName);
This method uploads the file specified by the first argument and saves it on the server with the name specified by the second argument. If the file is already present on the server then it is usually overwritten, though this depends on the server configuration.
SecureFTPConnection also supports file appending whereby any data that is in the local file but not in the remote file is appended to the end of the remote file. For example, if the local file is 100k in length, but the remote file is only 80k, then the last 20k of the local file is appended to the remote file. This feature can be useful for continuing interrupted downloads or updating log files. It is done by passing true as a third parameter to the UploadFile method:
ftpConnection.UploadFile(localFilePath, remoteFileName, true)
Downloading Files
Downloading of a file is done by the following method-call:
ftpConnection.DownloadFile(localFilePath, remoteFileName)
This method downloads the file specified by the second argument and saves it locally with the name specified by the first argument. If the file is already present on the local storage medium then it is overwritten.
Deleting Files
A file may be deleted by calling the DeleteFile method.
Notes:
(1) It is often useful to transfer data directly to and from memory rather than files. The topic How to transfer streams and byte-arrays explains how to do this.
(2) ExFTPConnection and SecureFTPConnection also offer asynchronous versions of these methods. These are recommended for improving the responsiveness of GUI applications. Please refer to the How to use asynchronous methods topic to learn more about this.