Reputation: 6005
I am writing a desktop app in C# for upload large sized files on a webserver using HTTP PUT. I have tried libcurl .net but it seems the bindings seem pretty difficult to use.
Is there a better and easier way?
PS: My server is nginx. I believe HTTP PUT is the best way but if there is a better alternative available on nginx, I can use that as well.
Upvotes: 7
Views: 11873
Reputation: 72658
Have you tried the built-in WebClient, doesn't get much simpler:
var wc = new WebClient();
wc.UploadData("http://www.example.com/upload-image", "PUT", imageData);
(WebClient.UploadFile is also available, which might be even better, depending on where your image data is located)
Upvotes: 15