I''ve been trying to create a page like this: http://img175.imageshack.us/img175/7323/mephistohw0.png I was able to browse through the Mephisto source and figure out the JavaScript to add upload fields dynamically, but I cannot figure out how to process an unlimited amount of uploads in the controller. In the Mephisto source it seems that each upload is stored in an array, however, I cannot recreate this in my application. Can anyone explain to me how to pull this off the DRY way? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sébastien Boisvert (sebhtml)
2007-Mar-28 17:41 UTC
Re: Handling Multiple Uploads on One Page
Hi, On Mar 27, 10:54 pm, "TeeC" <starni...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve been trying to create apagelike this:http://img175.imageshack.us/img175/7323/mephistohw0.png > I was able to browse through the Mephisto source and figure out the > JavaScript to add upload fields dynamically, but I cannot figure out > how to process an unlimited amount ofuploadsin the controller. > > In the Mephisto source it seems that each upload is stored in an > array, however, I cannot recreate this in my application. Can anyone > explain to me how to pull this off the DRY way?You have to give your html tag a tag like ''apples[]''. <%= form_remote_tag :update => @html_division, :url => {:action=> ''proceed''} %> <%= file_field_tag "apples[]" %> <%= file_field_tag "apples[]" %> <%= file_field_tag "apples[]" %> <%= file_field_tag "apples[]" %> <%= file_field_tag "apples[]" %> <%= file_field_tag "apples[]" %> <%= submit_tag "Send apples" %> <%= end_form_tag %> This way, your controller will receive an array. params[:apples].each do |an_apple| do_something_with_the_apple an_apple end --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
yeah, i had this exact problem. so i wrote a tutorial after going through mephisto line for line with a ruby book. share with me the javascript, please. http://rubyonrailsnotes.blogspot.com/2007/03/multiple-file-uploads-with-attachmentfu.html On Mar 27, 7:54 pm, "TeeC" <starni...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve been trying to create a page like this:http://img175.imageshack.us/img175/7323/mephistohw0.png > I was able to browse through the Mephisto source and figure out the > JavaScript to add upload fields dynamically, but I cannot figure out > how to process an unlimited amount of uploads in the controller. > > In the Mephisto source it seems that each upload is stored in an > array, however, I cannot recreate this in my application. Can anyone > explain to me how to pull this off the DRY way?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the help everyone, I was able to use Sébastien''s to handle the uploads, and Plewizard''s tutorial helped on processing it. Thanks again! Tony --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---