The standard CFCONTENT tag has had the file=“” feature from the start. This is where you can pass in a local file and have it sent to the client. Extremely handy when you are giving a client access to a file that may not be in the webapp directory or if you want to add extra security or logging to a given file before sending to the client.
Why limit it to a local file though? There are instances where you would want to do the same thing but with maybe a URL or an Amazon S3 object. For the URL there are times where you may want to fetch an internal only resource and send that out, or with S3, add extra logging/security without having to fetch it first to the server, saving as a file, and then sending out to the client.
OpenBD adds the remote=“” feature to CFCONTENT that fetches the remote content and streams it immediately to the client without buffering it on the client first.
Building on last weeks work with AmazonS3Write() function, I have just released a slew of updates and changes to the whole range of OpenBD functions designed to make it easier to work with Amazon’s S3.
The following functions have been updated with new functionality:
AmazonS3Write() Supports background uploads. Multi-part uploads (for larger files). Set storage class and ACL as part of same call. Retry logic. Callback CFC uploads. Amazon Server Side Encryption support.
AmazonS3Read() Amazon Server Side Encryption support.
AmazonS3Delete() Supports deleting of multiple files in a single request.
The below functions are new to the suite:
AmazonS3Copy() Copy a file to another location (including another bucket), setting the storage class and ACL in the process.
AmazonS3ChangeStorageClass() Changes the storage class of the given file.
AmazonS3BucketExists() Checks to see if a given bucket exists.
AmazonS3CreateBucket() Creates a new bucket.
AmazonS3DeleteBucket() Deletes a given bucket.
AmazonS3BucketSetACL() Sets the default ACL for the objects in this bucket.
AmazonS3BucketRequestPays() Flips the flag on who pays for the access to the files in the bucket.
I have added an end of year feature bonus to OpenBD, available in the nightly build edition. This improves the uploading capabilities to Amazon S3 from your CFML apps.
With this improvement, the AmazonS3Write() function brings the following features:
Retry capability, complete with configurable time to wait between retries
Automatic local file delete on successful upload
Background uploading, with CFC callback upon success or failure
This will help a lot with the management of uploading to S3. As wonderful a service as S3 is, it isn’t without the odd hiccup when uploading. Retry logic was a must in any business critical application that required data to be reliably uploaded.
This addition to OpenBD reduces the amount of code the CFML developer has to code and maintain, while increasing the reliability.