Ask A Question


You’re not receiving notifications from this thread.

An issue with uploading to S3 with jquery file upload

Taro Singh asked in Rails

Hey guys, this is driving me crazy. I'm pretty new to rails and I have been following the shrine & S3 videos using the cloud based ide c9. I got basic direct uploads to work flawlessly, but when I introduced jquery file upload on image attachment, chrome console returns after the add call.
There's probably something I'm not fully understanding here, can anyone guide me in the right direction?


Hi Taro, did you find a solution to this? Think I'm getting the same issue - so frustrating!


Hey Adam,
I did find the solution,

Firstly I did not include any stuff for shrines presign plugin. So based off this it would be
Shrine.plugin :presign_endpoint in the Shrine.rb file
mount Shrine.presign_endpoint(:cache) => "/YOUR MODEL HERE/upload/cache/presign" in your Routes.rb
then changing

$.getJSON("/YOUR MODEL HERE/upload/cache/presign", options, function(result) {
              console.log("presign", result);
              data.formData = result['fields'];
              data.url = result['url'];
              data.paramName = "file";

in the uploads.js file

Unless I'm forgetting something that should be the fix, let me know! But now I'm getting an issue where my form only uploads the cache file, never the full image and the form never submits.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,111+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.