Webclient equivalent of CURL command
问题 I am trying to upload a file via a POST to a REST API in a c# winform. If I run the following command with curl the file is uploaded successfully: curl.exe -H "Content-type: application/octet-stream" -X POST http://myapiurl --data-binary @C:\test.docx I have tried using WebClient in my WinForm: using (var client = new WebClient()) { client.Headers.Add("Content-Type", "application/octet-stream"); byte[] result = client.UploadFile(url, file); string responseAsString = Encoding.Default.GetString