Tracking Progress of an FTP Download or Upload


Use the StartTransfer, Transfer, and EndTransfer events to track the progress of a upload or download (i.e. transfer). Here is a basic example:

Ftp client = new Ftp(); string currentFile = "C:/path/to/my.file"; client.OnStartTransfer += (obj, ev) => { Console.WriteLine("Starting transfer of " + currentFile + (ev.Direction == 1 ? " from server to client." : " from client to server.")); }; client.OnTransfer += (obj, ev) => { Console.WriteLine("Transfer of " + currentFile + " is " + ev.PercentDone + "% complete."); }; client.OnEndTransfer += (obj, ev) => { Console.WriteLine("Ending transfer of " + currentFile + (ev.Direction == 1 ? " from server to client." : " from client to server.")); }; // ... some other code ... client.RemoteFile = currentFile; client.Download();

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.