Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Tcl) Demonstrate S3_UploadBytesDemonstrates how to upload a file to the Amazon S3 service.
load ./chilkat.dll # This example assumes the Chilkat HTTP API to have been previously unlocked. # See Global Unlock Sample for sample code. set http [new_CkHttp] CkHttp_put_AwsAccessKey $http "AWS_ACCESS_KEY" CkHttp_put_AwsSecretKey $http "AWS_SECRET_KEY" set bucketName "chilkat.qa" set objectName "images/sea_creatures/starfish.jpg" set localFilePath "qa_data/jpg/starfish.jpg" set contentType "image/jpg" set jpgData [new_CkBinData] set success [CkBinData_LoadFile $jpgData $localFilePath] if {!$success} then { puts "Failed to load $localFilePath" delete_CkHttp $http delete_CkBinData $jpgData exit } set jpgBytes [new_CkByteData] set success [CkBinData_GetBinary $jpgData $jpgBytes] set success [CkHttp_S3_UploadBytes $http $jpgBytes $contentType $bucketName $objectName] if {$success != 1} then { puts [CkHttp_lastErrorText $http] delete_CkHttp $http delete_CkBinData $jpgData delete_CkByteData $jpgBytes exit } puts "Success. File uploaded." delete_CkHttp $http delete_CkBinData $jpgData delete_CkByteData $jpgBytes |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.