objective c - iOS Amazon Cognito S3 metadata filenames -


how metadata s3 bucket contains friendly filename of file display purposes.

for example in table view have list of files in following format:

private/eu-west-1:2dcdgv-des3-3res-fsgr-123456xxxxx/demo directory/bxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx

now part (the key) "bxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" should myfile.jpg example.

for interested solved follows:

-(nsstring *)getfilemetadata:(nsstring *)fkey { __block nsstring *fname = @"";  awss3 *s3 = [awss3 defaults3]; awss3headobjectrequest *request = [awss3headobjectrequest new]; request.bucket = @"mys3bucketname"; request.key = fkey;  [[[s3 headobject:request] continuewithblock:^id _nullable(awstask<awss3headobjectoutput *> * _nonnull task) {     if(task.result.metadata != nil)     {         //do it...     }     else     {         //handle no data     }     return nil; }] waituntilfinished];  return fname; } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -