C# provides functionality to submit a post request, but there is nothing about uploading an image/file on MSDN. I'd like to do this without using raw headers.
Related questions
Upload files with HTTPWebrequest (multipart/form-data)
From stackoverflow
-
You can use
WebClientclass easily. It has anUploadFilemethod:var client = new WebClient(); client.UploadFile("http://server/upload.aspx", @"C:\file.jpg");Mehrdad Afshari : In that case, I'm afraid your question is essentially a dupe of the one linked above. -
My ASP.NET Upload FAQ has an article on this, with example code: Upload files using an RFC 1867 POST request with HttpWebRequest/WebClient. This code doesn't load files into memory, supports multiple files, and supports form values, setting credentials and cookies, etc.
0 comments:
Post a Comment