Xbase++
Xbase++
Backblaze S3 Upload Binary
See more Backblaze S3 Examples
Demonstrates how to upload the in-memory binary data to an Backblaze bucket.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cBucketName
LOCAL cObjectName
LOCAL cContentType
LOCAL oJpgData
LOCAL oXml
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
// keyID = Access Key ID or Access Key
oHttp:AwsAccessKey := "access-key"
// applicationKey = Secret Access Key or Secret Key
oHttp:AwsSecretKey := "secret-key"
// Region is the 2nd part of your S3 Endpoint
oHttp:AwsEndpoint := "s3.us-west-002.backblazeb2.com"
cBucketName := "chilkat-test-123"
cObjectName := "starfish.jpg"
// The Content-Type has the form type/subtype, such as application/pdf, application/json, image/jpeg, etc.
// See Explaining Content-Types
cContentType := "image/jpeg"
oHttp:KeepResponseBody := 1
oJpgData := CreateObject("Chilkat.BinData")
nSuccess := oJpgData:LoadFile("qa_data/jpg/starfish.jpg")
nSuccess := oHttp:S3_UploadBd(oJpgData, cContentType, cBucketName, cObjectName)
IF (nSuccess != 1)
? oHttp:LastErrorText
oXml := CreateObject("Chilkat.Xml")
oXml:LoadXml(oHttp:LastResponseBody)
? oXml:GetXml()
ELSE
? "JPG uploaded."
ENDIF
oHttp:destroy()
oJpgData:destroy()
oXml:destroy()