Skip to content

Commit

Permalink
Update readme to include S3 CORS config
Browse files Browse the repository at this point in the history
  • Loading branch information
eddturtle committed Feb 17, 2016
1 parent d6b9e43 commit 2ffc700
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions README.md
Expand Up @@ -24,15 +24,36 @@ Once we have the package installed we can make our uploader object, like so: (re
"YOUR_S3_BUCKET",
"eu-west-1"
);

More info on finding your region @ http://amzn.to/1FtPG6r

Then, using the object we've just made, we can use it to generate the form's url and all the needed hidden inputs

<form action="<?php echo $uploader->getFormUrl(); ?>" method="POST" enctype="multipart/form-data">
<?php echo $uploader->getFormInputsAsHtml(); ?>
<!-- Other Inputs Go Here -->
<!-- Other inputs go here -->
<input type="file" name="file">
</form>

We have an [example project](https://github.com/eddturtle/direct-upload-s3-signaturev4) setup to demonstrate.
### Example

We have an [example project](https://github.com/eddturtle/direct-upload-s3-signaturev4) setup, along with the JavaScript, to demonstrate how the whole process will work.

### S3 CORS Configuration

When uploading a file to S3 it's important that the bucket has a CORS configuration that's open to accepting files from elsewhere. Here's an example CORS setup:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

### Contributing

Expand Down

0 comments on commit 2ffc700

Please sign in to comment.