1
Reply

Uploading Files

Michael

Michael

Jan 27 2008 8:31 PM
3.1k
Hey I am trying to write a program that will upload a text file to my website and was fooling around with this code but was unable to get it to work.  Is this possbile to do something like this in a C# project? When I looked around on google all i saw was C# via ASP.net to complete this task. But I am trying to go for a desktop program that will upload this text file. Any help on this matter would be greatly appricated.

            WebClient  Client = new WebClient();
            NetworkCredential myCred = new NetworkCredential(
            "username", "userpassword", "domain?");
            Client.Credentials = myCred;
            Client.UploadFile("website","POST", "c:\texttext.txt");

Answers (1)