Open nicholasmartin opened 11 years ago
Found this blog post on using S3 Direct Upload with Paperclip (we're currently using Paperclip, otherwise we'd probably go with Carrierwave also). Either way, it might help.
That's my blog post. Let us know if you have any questions. :)
@uberllama @nathany If you'd be kind enough, could you please put up a simple s3_direct_upload application as an example? I'm very new to Rails & Javascript and can't get it to work despite working on it for days. Most of us noobs would really appreciate your help. Thanks!
@PsychoSherry Sorry, I don't have an application like that to share. I did write a little bit on the process we used. Not sure if that helps though.
@nathany I got it to work. It seems that I've been having the same problem as this guy. Using the monkeypatch in the comments, it started working. Thanks anyways.
@lifestylenetworker I don't know if you were able to complete your app, but this gem does need a simple working example. So I took the time out to make one. Just putting this here if any one needs it.
Hey guys, I've been planning to make an example repo based off my blog post and still do. Out sick this week but will try and put one together soonoish.
Has anyone gotten this to work with PUT the upload to an existing model record from the show page?
Mmm, it does not work. I get this error
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
I've got CORS set as suggested but no luck.
Are you using callback_method: "PUT"
in your form helper? The upload to S3 will always be a POST, but you need to amend your callback method to tell your Rails controller that you're updating a file, not creating one.
Ah, I was navigating to localhost:3000, but had 0.0.0.0:3000 set in my CORS configuration on the bucket. If I navigate to 0.0.0.0:3000, then I do see the progress bar going up, but then I get an error
POST https://{my-bucket-name}.s3-eu-west-1.amazonaws.com/ 400 (Bad Request)
And nothing is saved in the bucket.
I just changed my CORS configuration to allow access from http://localhost:3000, and I get the same problem.
Try using * for your allowed origin on your dev bucket and see if it works.
OK I did that and it makes no difference. I'm still getting POST https://{my-bucket-name}.s3-eu-west-1.amazonaws.com/ 400 (Bad Request)
Though the progress bar does go up.
I went back to https://github.com/pjambet/direct-upload which is supposedly the basis of the s3_direct_upload gem. After fiddling about with different names for the exported AWS params, I got it working. Horray!
So it must be doing something that the s3_direct_upload isn't doing. But what could it be?
@JohnSmall could you be more specific about your fiddling? I'm running into the same issue on a new site, which is kind of odd because I've used this approach dozens of times successfully.
@JohnSmall @chrishawk I'm facing the same issue too, have you managed to fix it?
same problem here. bar loads up, but s3 gives an error 400. any improvements on this? or some one who has same problem, u guys solved it?
@fatihtas - I found changing my bucket from London to Ireland sorted it out.. The issue I has was around authorisation.. https://stackoverflow.com/questions/26533245/the-authorization-mechanism-you-have-provided-is-not-supported-please-use-aws4
Hey all, I've been struggling for days with Carrierwave and Carrierwave_direct and I just can't get it to upload to a specific S3 directory (each member of my application needs to be able to upload to their own directory).
Anyway, I've been looking at S3 Direct Upload but am a little hesitant to try it out, mainly because the documentation about persisting the data is not 100% clear to me (still earning rails and very new to javascript).
I was wondering if any kind soul out there could share a super simple example of how you use S3 Direct Upload to upload and save S3 file information on a model.
I do apologize if this is too noobish...