Since there were questions about CDN and S3 I thought I would share this extension that I made some time ago. I really only built out the pieces that applied to what I needed, so it’s a pretty basic adaptation.
Happy to answer any questions or look at expanding functionality if needed.
Hi Dana, thanks for this wrapper - works well and much appreciated!
I have two questions though - perhaps you can help (there’s always more questions
[list=1]
[*]Can you provide an example of how to access the other functions in the S3 class? (I’m missing something there)
[*]Do you know any way to delete an entire S3 folder? (I’m storing user images in custom folders and want to be able to delete this folder when a user is deleted)
Further to my second question, I did find a way to delete all images in an S3 folder, but I had to use the Amazon S3 PHP SDK class that includes a method called ‘list_objects’.
This method supports a ‘prefix’ option that allows you to filter all objects by a particular folder (matching the prefix) and then once you have this subset, you can delete the individual files using ‘delete_object’.
Can you post how you are attempting to access the bucket? Amazon can be fairly picky about the structure of the bucket names and where/how you place your directory separators in accessing content.
Also, if you run the list buckets command, do you see the list that you expect, including the bucket you’re trying to access?