(AutoIt) S3 Upload File
Demonstrates how to upload a file to the Amazon S3 service.
Local $bSuccess = False
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
; Insert your AWS keys here:
$oHttp.AwsAccessKey = "AWS_ACCESS_KEY"
$oHttp.AwsSecretKey = "AWS_SECRET_KEY"
Local $sBucketName = "chilkat.ocean"
Local $sObjectName = "seahorse.jpg"
Local $sLocalFilePath = "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
Local $sContentType = "image/jpeg"
$bSuccess = $oHttp.S3_UploadFile($sLocalFilePath,$sContentType,$sBucketName,$sObjectName)
If ($bSuccess <> True) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Else
ConsoleWrite("File uploaded." & @CRLF)
EndIf
|