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.
2 Answers
You can use WebClient class easily. It has an UploadFile method:
var client = new WebClient();
client.UploadFile("http://server/upload.aspx", @"C:\file.jpg");
3 Comments
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.