(VBScript) Example: Http.S3_FileExists method
Demonstrates the S3_FileExists method.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
set http = CreateObject("Chilkat.Http")
' Insert your AWS keys here:
http.AwsAccessKey = "AWS_ACCESS_KEY"
http.AwsSecretKey = "AWS_SECRET_KEY"
bucketName = "chilkat.ocean"
objectName = "seahorse.jpg"
http.AwsRegion = "us-west-2"
http.AwsEndpoint = "s3-us-west-2.amazonaws.com"
retval = http.S3_FileExists(bucketName,objectName)
If (retval < 0) Then
outFile.WriteLine("Failed to check for the S3 object existence")
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
If (retval = 0) Then
outFile.WriteLine("The S3 object does not exist.")
WScript.Quit
End If
outFile.WriteLine("The S3 object exists.")
outFile.Close
|