Sample code for 30+ languages & platforms
Tcl

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

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"
CkHttp_put_AwsRegion $http "us-west-2"
CkHttp_put_AwsEndpoint $http "s3-us-west-2.amazonaws.com"

set retval [CkHttp_S3_FileExists $http $bucketName $objectName]
if {$retval < 0} then {
    puts "Failed to check for the S3 object existence"
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    exit
}

if {$retval == 0} then {
    puts "The S3 object does not exist."
    delete_CkHttp $http
    exit
}

puts "The S3 object exists."

delete_CkHttp $http