(Tcl) S3 Upload File
Demonstrates how to upload a file to the Amazon S3 service.
load ./chilkat.dll
set success 0
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Insert your AWS keys here:
CkHttp_put_AwsAccessKey $http "AWS_ACCESS_KEY"
CkHttp_put_AwsSecretKey $http "AWS_SECRET_KEY"
set bucketName "chilkat.ocean"
set objectName "seahorse.jpg"
set localFilePath "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
set contentType "image/jpeg"
set success [CkHttp_S3_UploadFile $http $localFilePath $contentType $bucketName $objectName]
if {$success != 1} then {
puts [CkHttp_lastErrorText $http]
} else {
puts "File uploaded."
}
delete_CkHttp $http
|