Skip to content
This repository was archived by the owner on Apr 25, 2019. It is now read-only.
This repository was archived by the owner on Apr 25, 2019. It is now read-only.

"403 forbidden" error when uploading selected file to S3 #116

@rtimpone

Description

@rtimpone

We're trying to use the iOS FilePicker SDK in a test app I'm putting together and I keep getting a 403 error when selecting a document.

The app is currently setup to do the following:

  1. Present an FPPickerController to the user
  2. User selects a source, then selects a file
  3. The selected file should be uploaded to our S3 bucket, then the S3 link should be returned to the FPPickerController's fpdelegate in an FPMediaInfo object

The selected file is successfully being uploaded to S3, but we're having two problems:

  1. If I specify a storePath (a directory inside of our default S3 bucket), it is being ignored and the file is instead uploaded to the root of the default S3 bucket. It looks like other users may be having this problem as mentioned in Doesn't save files to mentioned buckets and path #98.
  2. Once the file is successfully uploaded to our S3 bucket, an alert view appears with the text: "Request failed: forbidden (403)". This triggers the delegate method - (void)fpPickerControllerDidCancel:

Here is my app delegate code:

+ (void)initialize
{
    [FPConfig sharedInstance].APIKey = @"MY_API_KEY";
    [FPConfig sharedInstance].storeLocation = @"S3";
    [FPConfig sharedInstance].storeAccess = @"private";
    [FPConfig sharedInstance].storeContainer = @"my-bucket-name";
    [FPConfig sharedInstance].storePath = @"my-directory-name/";
}

And my ViewController code:

#pragma mark - Actions

- (IBAction)buttonAction: (id)sender
{
    FPPickerController *pickerController = [FPPickerController new];
    pickerController.fpdelegate = self;
    pickerController.dataTypes = @[ @"image/*" ];

    [self presentViewController: pickerController animated: YES completion: nil];
}

#pragma mark - FPPickerController Delegate Methods

- (void)fpPickerController: (FPPickerController *)pickerController didFinishPickingMediaWithInfo: (FPMediaInfo *)info
{
    NSLog(@"File Picker Controller Did Finish Picking Media With Info: %@", info);
}

- (void)fpPickerControllerDidCancel: (FPPickerController *)pickerController
{
    NSLog(@"File Picker Controller Did Cancel");
}

and the Podfile:

platform :ios, '8.0'

use_frameworks!

target :'MyAppName' do
  pod 'FPPicker', '~> 5.1.1'
end

Any help on this would be greatly appreciated. At this point, the two things I need are:

  1. A way to specify which directory in our S3 bucket the file should be saved to
  2. Access to the S3 link that the file was saved at

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions