Jump to content

Saving text files to a server in c#


hawksprite
 Share

Recommended Posts

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.com/files/yourname/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 
            {

            };
        }

Link to comment
Share on other sites

If I'm not mistaken this is .NET? Maybe?

If so, try searching through MSDN for an ftp function you could use? Maybe?

I've never worked with .NET, but I do know that for a Microsoft run information database, MSDN is quite amazing in finding what you're looking for in regards to a function.

Link to comment
Share on other sites

If I'm not mistaken this is .NET? Maybe?

If so, try searching through MSDN for an ftp function you could use? Maybe?

I've never worked with .NET, but I do know that for a Microsoft run information database, MSDN is quite amazing in finding what you're looking for in regards to a function.

Yeah it's .NET i found what i was looking for, thank you for the tip. I'll post a link in case someone else needs it.

http://www.logiclabz.com/c/ftp-file-upload...t-in-net-c.aspx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...