Click here to Skip to main content
Click here to Skip to main content

C# FTP Client Library

, 23 May 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
Easy to use FTP client library with features in mind.


This code is an FTP class library for adding FTP access to your projects. It is heavily based on a project (see background for original code), and is now contained in the source files. I was not sure how to update the original article or add to it so I am publishing this as a new article since there was an extensive re-work of the original code in an attempt to make it more developer-friendly.


This article, and code, are based upon the ftplib posted by J.P. Trosclair. A link to the article is here. I have left original copyright and credit notices in with the updated version of the code.

Using the code

I used nDoc to create a CHM file (in the doc directory of the code) to help with implementation. Its fairly simple, and you will mainly need basic FTP connection information (IP, username, etc.) to use the library.

An example is included in the documentation, and appears as so (to upload a file):

OpenFTP.FTP f = new OpenFTP.FTP();
f.Connect("", "username_here", "password_here");
f.Files.Upload(Path.GetFileName(sFileName), Path.GetFileName(sFileName));

while (!f.Files.UploadComplete)
    Console.WriteLine("Uploading: TotalBytes: " + 
        f.Files.TotalBytes.ToString() + ", : PercentComplete: " + 
Console.WriteLine("Upload Complete: TotalBytes: " + 
    f.Files.TotalBytes.ToString() + ", : PercentComplete: " + 

f = null;

Points of Interest

I liked the original article but decided that even though I could read and implement the code I wanted its implementation to be more simplistic so months later I won't have to re-read any code to figure how to include the methods in a new project. I have tried to remove the rough edges.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Anonymous Proxy Anonymous Proxy
I am a Senior-level .NET developer using C# for about 5+ years now.

Codeproject has been a tremendous resource for me over the years.

Comments and Discussions

GeneralRe: Active Mode Pinmemberliglio28-Jan-10 4:13 
GeneralRe: Active Mode PinmemberDaniel Castenholz29-Jan-10 9:22 
QuestionSocketException Error Code 11004 PinmemberZac Greve10-Jan-10 11:54 
AnswerRe: SocketException Error Code 11004 Pinmemberjmers10-Jan-10 16:18 
Questionupload folder PinmemberDirekt200718-Nov-09 5:07 
GeneralCF 3.5 PinmemberGateone7512-Aug-09 3:32 
RantLOL PinmemberSeishin#8-Apr-09 3:01 
GeneralRe: LOL PinmemberPhylum12322-Oct-09 6:25 
GeneralExceoption when trying to upload [modified] PinmvpJohn Simmons / outlaw programmer8-Jan-09 12:52 
QuestionHow to connect to two FTP Servers PinmemberLearnNetnAll15-Dec-08 22:59 
GeneralA socket operation encountered a dead network Pinmemberjosephx2k715-Dec-08 13:41 
Generalgood library Pinmemberemilioarp12-Nov-08 8:30 
Generalconnection was forcibly closed by the remote host at System.Net.Sockets. Pinmembernext100years11-Nov-08 1:55 
GeneralA comfortable FTP class in .NET PinmemberElmue27-Aug-08 13:22 
GeneralChangeDirectory Chrash PinmemberMember 42541521-May-08 12:52 
GeneralRe: ChangeDirectory Chrash Pinmemberjmers3-May-08 10:36 
GeneralRe: ChangeDirectory Chrash Pinmemberstreit31-May-08 14:13 
GeneralRe: ChangeDirectory Chrash Pinmemberemilioarp2-Oct-08 9:47 
GeneralRe: ChangeDirectory Chrash PinmemberB.Ritter3-Nov-08 10:50 
GeneralRe: ChangeDirectory Chrash [modified] PinmemberB.Ritter8-Nov-08 3:42 
GeneralRe: ChangeDirectory Chrash Pinmemberemilioarp10-Nov-08 9:18 
GeneralRe: ChangeDirectory Chrash PinmemberB.Ritter10-Nov-08 23:12 
GeneralRe: ChangeDirectory Chrash Pinmemberemilioarp12-Nov-08 5:24 
GeneralRe: ChangeDirectory Chrash Pinmemberjose.mira27-Apr-09 8:38 
GeneralRe: ChangeDirectory Chrash Pinmemberjose.mira4-May-09 8:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150414.1 | Last Updated 23 May 2007
Article Copyright 2007 by jmers
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid