Many file fields w/same name don't show up as params array


#1

All,

I have a page where I am allowing the user to specify multiple image
files that are related to one HTML document.

I’m trying to set up my file_field correctly but am having trouble.

I’m trying to post into an array of images that belongs to a document.

I’ve tried:

<%= file_field(‘document’, ‘image[]’) %>
<%= file_field(‘document[]’, ‘image[]’) %>

and when I do debug(params), I never see more than one image in the
“document” hash.

My expectation was that this I could get params to have a document
element that then had one value which would be a hash of image values.
What am I doing wrong here?

====================================================

Here is my form:

<%= form_tag( { :action => ‘upload_images’ },
{ :multipart => ‘true’ } )%>

<% for image in images do %> <% end %>
<%= image.path.split('/').last[0..39] %>: <% if ((! image.path.nil?) && (image.path.length > 40)) %> <%= h("...") %> <% end %> <%= file_field('document', 'image') %>

<%= submit_tag "Upload Images" %>

<%= end_form_tag %>

Thanks,
Wes