Posted By

fady_ay on 02/14/11


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

thastyle
Priestd09


FTP Client for C#


 / Published in: C#
 

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

  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. }

Report this snippet  

You need to login to post a comment.