Visual FoxPro
Visual FoxPro
S3 Delete File
See more Amazon S3 Examples
Demonstrates how to delete a remote file (object) on the Amazon S3 service.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcBucketName
LOCAL lcObjectName
lnSuccess = 0
* This example assumes the Chilkat HTTP API to have been previously unlocked
* See Global Unlock Sample for sample code
loHttp = CreateObject('Chilkat.Http')
* 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 = 1
lnSuccess = loHttp.S3_DeleteObject(lcBucketName,lcObjectName)
IF (lnSuccess <> 1) THEN
? loHttp.LastErrorText
RELEASE loHttp
CANCEL
ENDIF
IF (loHttp.LastStatus <> 204) THEN
? "Status code = " + STR(loHttp.LastStatus)
? loHttp.LastResponseBody
? "Failed."
RELEASE loHttp
CANCEL
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