Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An exploration in using the "BeforeUpload" event handler in Plupload as a means to generate an Amazon S3 upload policy tailored specifically for the current file.
JavaScript ColdFusion CSS
branch: master
Failed to load latest commit information.
app Add comment about saveimage method.
.gitignore Initial commit.
LICENSE.md Initial commit.
README.md Initial commit.

README.md

Using BeforeUpload To Generate Per-File Amazon S3 Upload Policies Using Plupload

by Ben Nadel (on Google+)

One of the really exciting things about Plupload is that you can use it upload files directly to Amazon S3 from the user's browser. Of course, doing so requires an upload "Policy" that Amazon S3 can use to validate the uploaded file. In the past, I've somewhat hard-coded that policy on page-load, which has all kinds of drawbacks and security considerations.

As such, I wanted to look at Plupload to see how we could generate per-file Amazon S3 upload policies that could be used, on the fly, to upload a file without leaving the "upload window" open for too long. After digging through the code, I found out that you could return "False" from the "BeforeUpload" event handler. Doing so pauses the queue processing, which provides us with a hook to talk to our application-server and get an Amazon S3 upload policy for the specific file.

Something went wrong with that request. Please try again.