HOWTO: Multiple file upload with file_column

Lots of requests but not many answers on this topic. Here is how you do
it:

FORM:

<% for i in 1..6 %> <% end %>
Title " name="<%= "picture[#{i}][title]" %>" size="30" type="text" />
Image " name="<%= "picture[#{i}][image_data_temp]" %>" type="hidden" /> " name="<%= "picture[#{i}][image_data]" %>" size="30" type="file" />

CONTROLLER:
params[:picture].each { |attr, value|
unless value[:image_data].blank?
new_image = Image.new
new_image.person_id = session[:person_id]
new_image.title = value[:title]
new_image.image = value[:image_data]
new_image.save
end
}

MODEL:
class Image < ActiveRecord::Base

file_column :image

end

Taylor S. schrieb:

<% end %> new_image.save

Hi Taylor,

how do you handle and display the errormessages, e.g: the 1st and 3rd
file donĀ“t match filesize or filetype etc out of a total of 4 ??

Best regards
matthi

ps: i have also multiple_file upload running, even my code is different,
the error_message_stuff should/could be handled the same