Public URLs via Amazon S3 CFC

I made another minor update to my Amazon S3 CFC this evening, this time to support PUTting public objects.  To this point, the CFC left the default ACL on new objects PUT on S3, meaning that you needed an authorized URL (via a query string signature) to retrieve them.  That was the use case I had when I built it, and again every time I've used it on other projects.  However, that's not every use case.

With this latest update, there is now an optional fifth parameter to 'putFileOnS3' named 'isPublic'.  It defaults to false (to retain backwards compatibility).  If you set it to true, the 'public-read' ACL will be placed on the object you're PUTting, making it immediately publicly available for retrieval.  There is a corresponding change to the private 'getRequestSignature' method for accepting headers on requests to sign per Amazon's CanonicalizedAmzHeaders format.

As always, the CFC itself is available (amazon.cfc.txt) and the project page is the place to get latest info/releases.

4 responses to “Public URLs via Amazon S3 CFC”

  1. M@


    May I ask why the opening and closing cfoutput tags are the bottom of the cfc?
    were they left in by mistake?


  2. Palyne

    Barney, do you have any put/delete example file (that calls your CFC) somewhere? I'm looking around your site but I can't seem to find it. I'm really excited to try this — the s3.cfc I've been using for years, for some reason barfed when I upgraded to CF9 shared hosting (barfs on the file.contentType parameter in the s3.putObject ref) and I can't figure out why. Maybe your CFC would work for me which would be awesome, but I need some kind of clue about how to call it — have you got one? Many many thanks if so — Palyne