Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have filepicker.io set s3 file as public?

How do I have Filepicker set the proper permissions when uploading to Amazon S3 so that the file is "public" in my s3 bucket?

like image 485
kels Avatar asked Nov 08 '12 01:11

kels


2 Answers

You can do this by making your s3 bucket into a static website.

With Amazon, go to the Properties for the bucket. In properties, the Website tab has a checkbox to enable making your bucket a static website.

If you need all the files to be https, then you can add the following security policy to your bucket.

{
    "Statement": [
        {
               "Sid": "AllowPublicRead",
               "Effect": "Allow",
                "Principal": {
                        "AWS": "*"
                },
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::NAME_OF_BUCKET_HERE/*"
        }
    ]
}
like image 123
Liyan Chang Avatar answered Oct 06 '22 23:10

Liyan Chang


https://developers.filepicker.io/docs/web/#store

filepicker.store(input, [options], onSuccess(FPFile){}, onError(FPError){}, onProgress(percent){})

Public Access

{access: 'public'}

Indicates that the file should be stored in a way that allows public access going directly to the underlying file store. For instance, if the file is stored on S3, this will allow the S3 url to be used directly. This has no impact on the ability of users to read from the FPUrl. Defaults to 'private'.

like image 27
zeroasterisk Avatar answered Oct 06 '22 23:10

zeroasterisk