Sample code for 30+ languages & platforms
Tcl

S3 Upload File

See more Amazon S3 Examples

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

Chilkat Tcl Downloads

Tcl

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