i have used code snippet amazon sample code. below code uploads data amazon s3 bucket, need url of upload file. going in right direction? or point me mistake making
any kind of appreciated.
awss3transfermanager *transfermanager = [awss3transfermanager defaults3transfermanager]; awss3transfermanageruploadrequest *uploadrequest = [awss3transfermanageruploadrequest new]; uploadrequest.bucket = s3bucketname; uploadrequest.key = s3uploadkeyname; uploadrequest.body = self.uploadfileurl; //uploadrequest.contentlength = [nsnumber numberwithunsignedlonglong:filesize]; [[transfermanager upload:uploadrequest] continuewithblock:^id(bftask *task) { // response awss3transfermanageruploadoutput *uploadoutput = task.result; nslog(@"bftask:%@",uploadoutput); // upload out put gives me following response return nil; }];
bftask response:
bftask:<awss3transfermanageruploadoutput: 0x1706606c0> { etag = "\"0aefedfa36b687a74025b1ad50f3101f\""; serversideencryption = 0; }
if need download file, can use awss3transfermanagerdownloadrequest
download file using sdk. alternatively, can use awss3presignedurlbuilder
generate pre-signed url download file.
if want know url of object, url follows following pattern:
https://<yours3endpoint>/<yourbucketname>/<yourobjectkeyname>
any objects in amazon s3 private default , not publicly readable. if want make publicly readable, need set acl
on awss3transfermanageruploadrequest
object.
see amazon s3 bucket public access considerations more details.
Comments
Post a Comment