Skip to content

Direct upload #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Direct upload #5

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 29, 2014

Direct upload to S3
Just need a directUpload: true option
Also solves the problem when the file is large and it takes longer than 35 seconds to upload it because of the heartbeatInterval

Template. MyTemplate.helpers
  forProfilePic: ->
    directUpload: true

CORS Permissions

<?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>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

This tells S3 to allow any domain access to the bucket and that requests can contain any headers,
which is generally fine for testing. When deploying, you should change the ‘AllowedOrigin’
to only accept requests from your domain.

Could be problems with SSL with VirtualHosted configuration, but I created an issue to make it work with CNAME record

@queso
Copy link
Contributor

queso commented Sep 29, 2014

Oh, interesting, so this uploads directly from the client into s3?

@ghost
Copy link
Author

ghost commented Sep 29, 2014

@queso Yes, it has some problems with SSL, but it's very easy to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant