Thread: FTP testing ...
View Single Post
Join Date: Mar 2008
Posts: 134
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: FTP testing ...

 
0
  #5
Jan 7th, 2009
Cool , i realized my problem is not my actual domain, its the path i"m specifying, so i have this

  1. private void FTP_Upload(object sender, EventArgs e)
  2. {
  3. FileStream fs_Upload = new FileStream(txtTo.Text + "/" + txtName.Text + ".zip", FileMode.Open, FileAccess.Read, FileShare.Read);
  4.  
  5. // Creating strings to hold values
  6. string m_server = txtftpServerName.Text;
  7. string m_username = txtftpUserName.Text;
  8. string m_password = txtftpPassword.Text;
  9. string m_UploadFile = fs_Upload.ToString();
  10. string m_directory = txtftpServerName + "Backups/";
  11.  
  12. m_ftp.Server = txtftpServerName.Text;
  13. m_ftp.Username = txtftpUserName.Text;
  14. m_ftp.Password = txtftpPassword.Text;
  15.  
  16. AsyncCallback m_callback = new AsyncCallback(CloseConnection);
  17.  
  18. try
  19. {
  20. // Logging in to the server
  21. m_ftp.Login();
  22.  
  23. // PROBLEM !!! ????
  24. m_ftp.RemotePath = ".";
  25. // PROBLEM !!! ????
  26. m_ftp.UploadDirectory("Backups/", false);
  27.  
  28. // Uploading the selected file
  29. m_ftp.Upload("c://DBNAME.bak.zip");
  30.  
  31. // Closing class
  32. m_ftp.Close();
  33. }
  34. catch (Exception Ex)
  35. {
  36. // Messagebox shows errors
  37. MessageBox.Show("File transfer protocol failed " + Ex.Message);
  38.  
  39. // Sending error Mail
  40. MailOnError(sender, e);
  41. }
  42.  
  43. Application.DoEvents();
  44. }

I am uncertain about the "m_ftp.UploadDirectory("Backups/", false);" part , because it tries to FTP to my own PC, is there any other way of setting a path on a server ??

The Path should be Root -> Backups -> File must save here

Any help Please ...
Last edited by cVz; Jan 7th, 2009 at 7:42 am.
Delphi & C# programmer deluxe...
Reply With Quote