Set ACL on file_put_contents using PHP AWS SDK

Question:


This code works fine and dandy and I’m seeing my images upload to my bucket. But I need to set the ACL to public-read as I’m sending this file to S3 because I will be displaying the images on my website. I can’t figure out a way to do it using this method. Ideas?

Answer:

The S3 Stream Wrapper supports additional parameters to S3 via stream contexts. Try something like this:

Leave a Reply