I just switched a project from Dragonfly to Carrierwave, specifically to
see if I could take advantage of Carrierwave Direct, which uploads large
files directly to S3 or another cloud storage.
I was able to make a form containing a single file field that would
upload to S3. What I could not work out was how to upload the file to S3
AND other form elements to the model that had Carrierwave mounted on it.
I ended up punting and just doing the two-step upload to the server and
server stores the file in S3 using regular Carrierwave (not Direct).
Can anyone point me to an example of Carrierwave Direct that
incorporates other form fields saved into the same ActiveRecord as the
And it doesn’t matter what storage you chose, local filesystem, S3 or
other cloud storage.
Your form is submitted and the location of uploaded file, along with
attributes of the model you are editing
are stored in the database. So, you question
What I could not work out was how to upload the file to S3 AND other
form elements to the model that had Carrierwave mounted on it.
What I could not work out was how to upload the file to S3 AND other form
elements to the model that had Carrierwave mounted on it.
I was able to make a form containing a single file field which would
upload using Carrierwave Direct to upload to S3 without my server
acting as a middle-man. I was not able to suss out how to combine such a
file field with other fields intended for my server’s eyes.
I was perfectly able to create a single combined form which contained
the file AND its metadata, upload both to my server, and yes, using Fog,
store the file on S3. That’s with ordinary Carrierwave, which is
lovingly documented and a drop-in replacement for nearly every other
file storage scheme on Rails.
The issue, which I still do not understand how to solve without an Ajax
sidecar submitting two forms at once, is how to send part of the data
directly to S3 and the remainder to my server, and maintain a connection
between the two.
I know this is almost 2 years old now, but I’m trying to figure out how
do the same thing with Carrierwave Direct. Did you ever solve this? If
did, would you mind posting how? Code snippets are also appreciated.
Thanks again for the link, Walter. With some tweaking, got it working
in the same form. I’m not processing the uploads at all but it seems
you could still use carrierwave or paperclip to process in the
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.