We are rather spoiled with the requests
library in python.
Are you running .NET 4 or 4.5? If so, take a look at Joshcodes answer to Sending Files using HTTP POST in c# - it uses Microsoft.Net.Http
which is by far the best HTTP library in the .NET world these days.
UPDATE: I haven't checked this for accuracy yet, but it could go something like this:
static HttpResponseMessage UploadFileWithParam(string requestUri, string fileName, string key1, string val1)
{
using (var client = new HttpClient())
{
using (var content = new MultipartFormDataContent())
{
content.Add(new StringContent(val1), key1);
var fileContent = new StreamContent(File.OpenRead(fileName));
fileContent.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
{
FileName = fileName
};
content.Add(fileContent);
return client.PostAsync(requestUri, content).Result;
}
}
}
// UploadFileWithParam("http://example.com", @"c:\...", "param1", "value1").Dump();