Sample code for 30+ languages & platforms
C++

Wasabi Upload File

See more Wasabi Examples

Demonstrates how to upload a file to a Wasabi bucket.

Chilkat C++ Downloads

C++
#include <CkHttp.h>
#include <CkXml.h>

void ChilkatSample(void)
    {
    bool success = false;

    //  This example assumes the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    CkHttp http;

    //  Insert your access key here:
    http.put_AwsAccessKey("access-key");

    //  Insert your secret key here:
    http.put_AwsSecretKey("secret-key");

    http.put_AwsEndpoint("s3.wasabisys.com");

    const char *bucketName = "chilkattest";
    const char *objectName = "seahorse.jpg";
    const char *localFilePath = "qa_data/jpg/seahorse.jpg";
    const char *contentType = "image/jpg";

    http.put_KeepResponseBody(true);

    success = http.S3_UploadFile(localFilePath,contentType,bucketName,objectName);

    if (success != true) {
        std::cout << http.lastErrorText() << "\r\n";

        CkXml xml;
        xml.LoadXml(http.lastResponseBody());
        std::cout << xml.getXml() << "\r\n";
    }
    else {
        std::cout << "File uploaded." << "\r\n";
    }
    }