Using cURL to post .wav files to cloud storage?

Hello! I’m trying to figure out how to post a .wav file to a cloud file hosting solution.

In the short term, I decided to use https://upload.io/docs/upload-api#uploading-files since it’s a lot more straightforward than using an Amazon S3 bucket.

In my C++, I have the following working:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
  
curl_easy_setopt(curl, CURLOPT_URL, "https://audiopoop.free.beeceptor.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
  
if(res != CURLE_OK)
{
  DEBUG("curl_easy_perform() failed");
  DEBUG("Cert path was: ");
  DEBUG(cert_path.c_str());
  DEBUG(curl_easy_strerror(res));
}

This makes an HTTP GET to beeceptor.com, where I could see the incoming webservice call. Again, this was successful.

My next step is to make a POST to upload.io. They’re example post looks like:

curl --data-binary @sample-image.jpg \
     -H "Content-Type: image/jpeg" \
     -H "Authorization: Bearer YOUR_PUBLIC_API_KEY" \
     -X POST "https://api.upload.io/v2/accounts/{accountId}/uploads/binary"

I’m having some trouble figuring out how to translate that command line usage into C++.

Would it be something like…

// Forgive me....
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);

// Set content type
struct curl_slist *hs=NULL;
hs = curl_slist_append(hs, "Content-Type: audio/wav");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hs);

// Here's where I'm having issues...
// Should I reload the saved .wav file into a char * array, 
// then send that array into these two lines?
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, sample->sample_length);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, sample->data);

// I haven't updated this yet.  But it will point to upload.io eventually
curl_easy_setopt(curl, CURLOPT_URL, "https://audiopoop.free.beeceptor.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);

Thanks!
Bret