3 Replies - 2666 Views - Last Post: 13 September 2009 - 10:43 AM Rate Topic: -----

#1 hawksprite  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 137
  • Joined: 11-September 09

Saving text files to a server in c#, Need help.

Posted 12 September 2009 - 08:15 PM

I have a program that saves every time the text is changed(Code Below) It currently saves to a local .txt file. I need it to save to a remote location (e.x. http://hawksprite.co...name/stuff.txt) But am not sure how to do it. Is there a ftp function that i can use? Much help needed, thanks.

 private void text_TextChanged(object sender, EventArgs e)
		{

			System.IO.StreamReader myFile2 =
			new System.IO.StreamReader("settin/fl.txt");
			string stati = myFile2.ReadToEnd();
			myFile2.Close();
			if (stati == "true")
				stat.Text = "Fluid Save Is On.";
			else
				stat.Text = "Fluid Save Is Off.";


			System.IO.StreamReader myFile =
			new System.IO.StreamReader("settin/fl.txt");
			string fls = myFile.ReadToEnd();
			myFile.Close();

			if (fls == "true")
			{
				save.Text = "saving....";

				using (StreamWriter sw = new StreamWriter("settin/ftext.txt"))
				{
					// Add the document text to the file.
					sw.Write(text.Text);
				}

				save.Text = "Done";
			}
			else
			{

			};
		}



Is This A Good Question/Topic? 0
  • +

Replies To: Saving text files to a server in c#, Need help.

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6111
  • View blog
  • Posts: 23,671
  • Joined: 23-August 08

Re: Saving text files to a server in c#, Need help.

Posted 12 September 2009 - 09:31 PM

It all depends on how the server is set up. An HTTP PUT might work, or FTP, or SCP.
Was This Post Helpful? 0
  • +
  • -

#3 hawksprite  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 137
  • Joined: 11-September 09

Re: Saving text files to a server in c#, Need help.

Posted 13 September 2009 - 10:08 AM

View PostJackOfAllTrades, on 12 Sep, 2009 - 08:31 PM, said:

It all depends on how the server is set up. An HTTP PUT might work, or FTP, or SCP.


I think FTP would be my best bet, but i'm not sure how to setup an FTP connection in C#
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6111
  • View blog
  • Posts: 23,671
  • Joined: 23-August 08

Re: Saving text files to a server in c#, Need help.

Posted 13 September 2009 - 10:43 AM

Have you tried searching Google for "ftp C#"?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1