Sample code for 30+ languages & platforms
C#

Example: Http.HttpBinary method

Demonstrates the HttpBinary method.

Chilkat C# Downloads

C#
bool success = false;

string localFilePath = "C:/example/zips/data.zip";

Chilkat.BinData bd = new Chilkat.BinData();
success = bd.LoadFile(localFilePath);
if (success == false) {
    Debug.WriteLine(bd.LastErrorText);
    return;
}

byte[] zipBytes = null;
zipBytes = bd.GetData();

string url = "https://example.com/api/v1/sites/123/deploys";

//  Send a POST with a binary HTTP request body.
Chilkat.HttpResponse resp = new Chilkat.HttpResponse();
Chilkat.Http http = new Chilkat.Http();

success = http.HttpBinary("POST",url,zipBytes,"application/zip",resp);
if (success == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine("Response Status Code: " + Convert.ToString(resp.StatusCode));
Debug.WriteLine("Response body:");
Debug.WriteLine(resp.BodyStr);