(Lianja) S3 Delete File
Demonstrates how to delete a remote file (object) on the Amazon S3 service.
// This example assumes the Chilkat HTTP API to have been previously unlocked
// See Global Unlock Sample for sample code
loHttp = createobject("CkHttp")
// Insert your access key here
loHttp.AwsAccessKey = "AWS_ACCESS_KEY"
// Insert your secret key here
loHttp.AwsSecretKey = "AWS_SECRET_KEY"
lcBucketName = "chilkattest"
lcObjectName = "starfish.jpg"
loHttp.KeepResponseBody = .T.
llSuccess = loHttp.S3_DeleteObject(lcBucketName,lcObjectName)
if (llSuccess <> .T.) then
? loHttp.LastErrorText
release loHttp
return
endif
if (loHttp.LastStatus <> 204) then
? "Status code = " + str(loHttp.LastStatus)
? loHttp.LastResponseBody
? "Failed."
release loHttp
return
endif
// 204 is the success response status.
// When successful, the response body will be empty.
? "Status code = " + str(loHttp.LastStatus)
? "Success. Object deleted."
release loHttp
|