# HOWTO: Multiple file upload with file\_column

**URL:** <https://www.ruby-forum.com/t/howto-multiple-file-upload-with-file-column/89257>\
**Category:** Rails\
**Created:** [March 19, 2007, 1:47am UTC](https://www.ruby-forum.com/t/howto-multiple-file-upload-with-file-column/89257 "2007-03-19T01:47:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taylorstrait](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@taylorstrait](https://www.ruby-forum.com/u/taylorstrait)\
**Post date:** [March 19, 2007, 1:47am UTC](https://www.ruby-forum.com/t/howto-multiple-file-upload-with-file-column/89257/1 "2007-03-19T01:47:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![taylorstrait](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@taylorstrait](https://www.ruby-forum.com/u/taylorstrait)\
**Post date:** [March 19, 2007, 3:42pm UTC](https://www.ruby-forum.com/t/howto-multiple-file-upload-with-file-column/89257/2 "2007-03-19T15:42:25Z")

</div>

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
