WebClient
is a very decent layer of abstraction when compared to HttpPostRequets
, in most situations.
using (WebClient webClient = new WebClient())
{
return webClient.UploadFile(url, path);
}
However, the class doesn't seem to include an option for the name of the input field. Here, "file"
must be the name of the input field.
From Wireshark
Content-Disposition: form-data; name="file"; filename="test.txt"
Is there a way to specify the "name" field, without going back to HttpPostRequest?