Sample code for 30+ languages & platforms
Xbase++

S3 Upload File

See more Amazon S3 Examples

Demonstrates how to upload a file to the Amazon S3 service.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cBucketName
LOCAL cObjectName
LOCAL cLocalFilePath
LOCAL cContentType

nSuccess := 0

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

oHttp := CreateObject("Chilkat.Http")

//  Insert your AWS keys here:
oHttp:AwsAccessKey := "AWS_ACCESS_KEY"
oHttp:AwsSecretKey := "AWS_SECRET_KEY"

cBucketName := "chilkat.ocean"
cObjectName := "seahorse.jpg"
cLocalFilePath := "qa_data/jpg/seahorse.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"

nSuccess := oHttp:S3_UploadFile(cLocalFilePath, cContentType, cBucketName, cObjectName)

IF (nSuccess != 1)
    ? oHttp:LastErrorText
ELSE
    ? "File uploaded."
ENDIF

oHttp:destroy()