Giter Club home page Giter Club logo

Comments (9)

polaski avatar polaski commented on July 2, 2024

To be more specific, here's my example code:

NSString *tmpFile = [NSTemporaryDirectory() stringByAppendingPathComponent:@"temp_avatar.jpg"];
AFAmazonS3Manager *manager = [[AFAmazonS3Manager alloc] initWithAccessKeyID:@"---- MY_AWS_KEY -------" secret:@"------ MY_AWS_SECRET ------"];
manager.requestSerializer.bucket = @"my_bucket_name_on_S3";
manager.requestSerializer.regions = AFAmazonS3USStandardRegion;
[manager postObjectWithFile:tmpFile destinationPath:@"images/users/avatars" parameters:nil progress:^(NSUInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
  NSLog(@"%f%% Uploaded", (totalBytesWritten / (totalBytesExpectedToWrite * 1.0f) * 100));
} success:^(id responseObject) {
  NSLog(@"Upload Complete, %@", responseObject);
} failure:^(NSError *error) {
  NSLog(@"Upload Complete");
}];

First of all I am not sure if I'm doing it right when i'm setting the buckets and regions on manager.requestSerializer. I just figured it out looking at the code but all the example codes--since they're based on the older version--directly sets bucket and regions properties on AFAmazonS3Client.

Also, I'm not sure what I'm supposed to be passing to destinationPath parameter on postObjectWithFile method. Is it the full path including the filename, or just the folder path to which I will be storing the file? (By the way I've tried both but neither works)

Lastly, is there something I should be doing that I'm not doing here? Thank you.

from afamazons3manager.

cameronehrlich avatar cameronehrlich commented on July 2, 2024

+1

from afamazons3manager.

jonathandring avatar jonathandring commented on July 2, 2024

+1

from afamazons3manager.

conradwt avatar conradwt commented on July 2, 2024

@polaski I'm in the process of integrating an iOS app which retrieves its images from Amazon S3. However, I'm not clear as to how to use this API from the given example. Did you resolve your issue? At this time, the example uses AFAmazonS3Manager. However, I have only been able to declare AFAmazonS3Client. Is there better documentation elsewhere which clearly explains how to use this client?

from afamazons3manager.

chrisallick avatar chrisallick commented on July 2, 2024

anybody?

from afamazons3manager.

jonathandring avatar jonathandring commented on July 2, 2024

I gave up with this, as it is completely unfathomable, switched to cloudfront with signed URLs and wrote a simple php script to generate the signed urls, then used AFDownloadRequestOperation to pull the data down to the app using the signed URLs. I used the same URL format to request URLs from my PHP script that Amazon uses for signed URLs, just didn't have the Amazon secret in the app to make it all more secure.

from afamazons3manager.

chrisallick avatar chrisallick commented on July 2, 2024

Ok, @jonathandring I found an old post from stack overflow, hahahah ironically written by me i know see, of how i solved this problem before

http://stackoverflow.com/questions/15069772/aws-s3-upload-image-to-bucket-ios-app

Basically I switched over to the AWS S3 cocoapod and have had great success with it. Currently used in a couple products I released. I'll find my code and put together a gist. Would you mind explaining what cloudfront and the signed URL thing is all about?

Maybe I'm not doing something I should be :)

from afamazons3manager.

jonathandring avatar jonathandring commented on July 2, 2024

Cloudfront is Amazons Content Distribution Network (CDN) which provides cached copies of S3 data worldwide, the content can be secured or unsecured:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
Secured content is accessed using signed URLs, the following post explains how to generate the URLs with a server:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CreateURL_PHP.html

from afamazons3manager.

mattt avatar mattt commented on July 2, 2024

My sincere apologies for any inconvenience caused by vague and outdated documentation. I'm in the process of working through open PRs and issues now, and will be releasing updates soon.

from afamazons3manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.