943,682 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1532
  • C# RSS
Jan 7th, 2009
0

FTP testing ...

Expand Post »
Hi there,

I would like to know if there is any default settings one can use to test FTP settings etc, i am doing an application that does database backups , then zips the backup and FTP it to the server, i believe it is working because at the moment i am using these settings

ftp.Server = "ftp.secureftp-test.com";
ftp.Username = "test";
ftp.Password = "test";

C# Syntax (Toggle Plain Text)
  1. ***FTP refers to the class i wrote that handles the ftp

Now this works all good and all but ftp.secureftp-test.com obviously declines my attempt to upload the files, does anyone know any better idea or location ??

Thanks in advance...

mr VonZipper
Last edited by cVz; Jan 7th, 2009 at 4:51 am.
Similar Threads
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jan 7th, 2009
0

Re: FTP testing ...

Load an FTP server onto your pc.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Jan 7th, 2009
0

Re: FTP testing ...

Ive got localhost ???
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jan 7th, 2009
0

Re: FTP testing ...

as long as theres an FTP server on it, yes, you can use localhost.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Jan 7th, 2009
0

Re: FTP testing ...

Cool , i realized my problem is not my actual domain, its the path i"m specifying, so i have this

C# Syntax (Toggle Plain Text)
  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.
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jan 7th, 2009
0

Re: FTP testing ...

"Root->Backups" whats this? this isnt a directory format, simple answer you need to log in using a command line ftp to your ftp server, look at the directories it gives you and work out the path relative to where you want to go and then change to it.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: What kind of aplication Can I create to test myself???
Next Thread in C# Forum Timeline: c# windows server 2003





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC