import AWSS3
let transferUtility = AWSS3TransferUtility.default()
//In order to customize the header information, we use the AWSS3TransferUtilityUploadExpression class
let expression = AWSS3TransferUtilityUploadExpression()
//We want our file to be publicly available by default
expression.setValue("public-read", forRequestParameter: "x-amz-acl")
//Copy the custom Meta information into the expression
transferUtility.uploadFile(uploadRequest.body, bucket: uploadRequest.bucket ?? "", key: uploadRequest.key ?? "", contentType: uploadRequest.contentType ?? "", expression: expression) { (task, error) in }
1条答案
按热度按时间vx6bjr1n1#
使用处理后台上载的AWSS3TransferUtility
不要忘记在应用程序委托中添加以下代码