Skip to content

Instantly share code, notes, and snippets.

@ElliotWood
Last active December 15, 2015 12:28
Show Gist options
  • Save ElliotWood/5259918 to your computer and use it in GitHub Desktop.
Save ElliotWood/5259918 to your computer and use it in GitHub Desktop.
Upload a File with FTP with C# example
private static void Upload(string ftpServer, string userName, string password, string filename)
{
using (System.Net.WebClient client = new System.Net.WebClient())
{
client.Credentials = new System.Net.NetworkCredential(userName, password);
client.UploadFile(ftpServer + "/" + new FileInfo(filename).Name, "STOR", filename);
}
}
Then it's just
Upload("ftp://192.168.1.1", "UserName", "Password", "2013list.html");​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment