Handling Multiple Uploads on One Page

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?

Hi,

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

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

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