根据标题,如何将超过1张图像上传到AWS S3?我能够将1张图片成功上传到我的AWS S3存储桶中。但是,我的应用程序允许用户上传最多三张图片,有没有办法不指定存储桶,并且AWSTransferManager
再次三次?
let uploadRequest: AWSS3TransferManagerUploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.bucket = "mybucket"
uploadRequest.ACL = AWSS3ObjectCannedACL.PublicRead
uploadRequest.key = "media/uploads"
uploadRequest.contentType = "image/png"
uploadRequest.body = url
let transferManager: AWSS3TransferManager = AWSS3TransferManager.defaultS3TransferManager()
transferManager.upload(uploadRequest).continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock: {(task: AWSTask) -> AnyObject! in
if task.error != nil {
print(task.error)
NSLog("Error uploading : " + uploadRequest.key!)
}
else {
NSLog("Upload completed")
})
}