Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File upload HTTP PUT in C#

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.

like image 882
sharjeel Avatar asked Jun 29 '10 06:06

sharjeel


1 Answers

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)

like image 85
Dean Harding Avatar answered Sep 28 '22 01:09

Dean Harding