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 Carrierwave details? Thanks, Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Docs say you should use Fog gem https://github.com/jnicklas/carrierwave#using-amazon-s3 And it doesn''t matter what storage you chose, local filesystem, S3 or any other cloud storage. Your form is submitted and the location of uploaded file, along with other 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 otherform elements to the model that had Carrierwave mounted on it. is inappropriate. On Thursday, August 30, 2012 4:29:25 AM UTC+9, Walter Lee Davis wrote:> > 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 Carrierwave > details? > > Thanks, > > Walter-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/yO3w3CjSNXkJ. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2012-Aug-30 15:38 UTC
Re: Carrierwave Direct and additional form elements
On Aug 30, 2012, at 5:24 AM, tundrax wrote:>> >> >> >> On Thursday, August 30, 2012 4:29:25 AM UTC+9, Walter Lee Davis wrote: >> 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 Carrierwave details? >> >> Thanks, >> >> Walter > > Docs say you should use Fog gem > > https://github.com/jnicklas/carrierwave#using-amazon-s3 > > And it doesn''t matter what storage you chose, local filesystem, S3 or any other cloud storage. > Your form is submitted and the location of uploaded file, along with other 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. > > is inappropriate.Sorry, what? 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. If you can help, I would appreciate it. Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Reasonably Related Threads
- Help Regarding Amazon S3 and Career Wave along with Rspec
- Rails 2.3.11 and carrierwave, can't find generator
- carrierwave tutorial
- Store files with carrierwave to remote server (may be via ssh/scp)?
- How to secure file access using Carrierwave + S3 hosted on Heroku