Upload HTTP PUT file in C #

I am writing a C # desktop application to upload large files to a web server using HTTP PUT. I tried libcurl.net, but it seems that the bindings seem rather difficult to use.

Is there a better and easier way?

PS: My server is nginx. I believe that HTTP PUT is the best way, but if there is a better alternative available on nginx, I can use that too.

+3
source share
1 answer

You tried the built-in WebClient , not much simpler:

var wc = new WebClient();
wc.UploadData("http://www.example.com/upload-image", "PUT", imageData);

( WebClient.UploadFile might also be better, depending on where your image data is located)

+12

Source: https://habr.com/ru/post/1752206/


All Articles