Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SergioGregorutti's avatar

Amazon S3 files: get full url of file uploaded and set permissions to public

Hi all,

Im working with an Amazon S3 bucket. The upload functionality is working fine.

But I dont know how to do a simple thing like show an image uploaded to the Amazon S3 bucket.

How can I get the link to the image?

Also, I dont know how to set the permissions of the file to public. By default only the owner can see the image.

Thanks!

0 likes
3 replies
SergioGregorutti's avatar
Level 3

Ok, I finally fix the error.

The problem was in the Amazon S3 bucket configuration.

In the Bucket Policy Editor I added this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::my_bucket_name/*"
            ]
        }
    ]
}

And now is working :)

More info: https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html

Thanks @jakeryansmith for your help.

2 likes

Please or to participate in this conversation.