Multiple File Upload with Ruby on Rails and file_column
Monday, January 21st, 2008I just found a multiple file upload script here, and a rewrite for the use with the nice file_column plugin. There was a conflict with the mootools not playing well with prototype used by default in every Ruby on Rails application. So I’ve done a rewrite of the first version of this script. Of course there are other (newer) file upload plugins like attachment_fu, but they do not have the functionality I need. Generally they should work with this solution, too.
Here is the demo (browse for an image):
In your controller you just have to parse each param:
params[:previews].each do |preview|
Preview.create(:filename => preview[1]) if !preview[1].blank?
end
That’s it! Grab the script here!