Perl
Chilkat2 Perl
Wasabi Upload File
See more Wasabi Examples
Demonstrates how to upload a file to a Wasabi bucket.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
my $http = Chilkat2::Http->new;
# Insert your access key here:
$http->AwsAccessKey('access-key');
# Insert your secret key here:
$http->AwsSecretKey('secret-key');
$http->AwsEndpoint('s3.wasabisys.com');
my $bucketName = 'chilkattest';
my $objectName = 'seahorse.jpg';
my $localFilePath = 'qa_data/jpg/seahorse.jpg';
my $contentType = 'image/jpg';
$http->KeepResponseBody(1);
my $success = $http->S3_UploadFile($localFilePath, $contentType, $bucketName, $objectName);
if (!$success) {
print $http->LastErrorText, "\n";
my $xml = Chilkat2::Xml->new;
$xml->LoadXml($http->LastResponseBody);
print $xml->GetXml(), "\n";
} else {
print "File uploaded.\n";
}