Direct Browser to S3 Upload Example
JavaScript Ruby PHP
Latest commit 200ca1b Jun 12, 2013 @carsonmcdonald Add lock file.
Permalink
Failed to load latest commit information.
.gitignore
Gemfile Initial ruby/sinatra version. Sep 2, 2012
Gemfile.lock
README.md Updated README Sep 2, 2012
app.js Initial PHP version. Sep 2, 2012
app.rb
config.ru
index.html
signput.php Initial PHP version. Sep 2, 2012
styles.css

README.md

Direct Browser to S3 Upload Example

This is an example of using the HTML5 FileAPI, XHR2, CORS and signed S3 PUT requests to upload files directly from a browser to S3. There are sample server side signing apps for both PHP and Ruby with Sinatra. The default

You can read more details about the code in my direct browser uploading to Amazon S3 blog post.

Setting up Amazon S3 CORS

Before using any of the examples you will need to set up your S3 CORS data. It is easy enough to do that using the AWS console. The following is an example CORS configuration that should work wherever you install the example:

<CORSConfiguration>
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>Content-Type</AllowedHeader>
        <AllowedHeader>x-amz-acl</AllowedHeader>
        <AllowedHeader>origin</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Installing to Heroku

For more information see the Heroku rack guide.