Multiple File Upload with Ruby on Rails and file_column

I 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!

5 Responses to “Multiple File Upload with Ruby on Rails and file_column”

  1. Justin Cunningham Says:

    I made a LGPL multiple file upload applet, and a rails plugin to go along with it to make it easy to use. It’s customizable, extensively documented, and has some great features like live progress bars and upload queuing in real time. Check it out at http://multibitshift.com.

  2. txarli Says:

    hi! im trying to get your code runing.. but i’ve this error

    undefined method `filename=’ for

    any idea whats happen?

    btw… great blog :)

  3. gauda Says:

    I just updated the script regarding this bug! I hope that helps!

  4. Marra Says:

    Hey! Thanks so much for this tut! I am having the same issue txarli is having.

    undefined method `filename=’ for #

    Any help would be appreciated – I’ll continue to troubleshoot myself in the meantime.

    Again, THANK YOU.

  5. Thomas Reitz Says:

    Thanks for sharing your idea…

Leave a Reply