FTP Client for C#


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. www.c-sharpcorner.com/uploadfile/danglass/ftpcl...9/23/08
  2. private FtpClient ftp = null;
  3. private void UploadPicture(string imagePath)
  4. {
  5. string FtpServer = ConfigurationSettings.AppSettings["FtpServer"];
  6. string FtpUserName = ConfigurationSettings.AppSettings["FtpUserName"];
  7. string FtpPassword = ConfigurationSettings.AppSettings["FtpPassword"];
  8. AsyncCallback callback = new AsyncCallback(CloseConnection);
  9. ftp = new FtpClient(FtpServer,FtpUserName,FtpPassword);
  10. ftp.Login();
  11. ftp.BeginUpload(imagePath, callback);
  12. ftp.Close();
  13. }
  14. private void CloseConnection(IAsyncResult result)
  15. {
  16. Debug.WriteLine(result.IsCompleted.ToString());
  17. if ( ftp != null ) ftp.Close();
  18. ftp = null;
  19. }

URL: http://www.c-sharpcorner.com/uploadfile/danglass/ftpclient12062005053849am/ftpclient.aspx?articleid=620360d4-ec30-4ab3-a724-369e656d4003&login=true&user=fady_ay

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.