Multiple File Upload

Hello together,

I developed a file upload in my application like this (files uploaded
belong to a project):


def upload_attachment
project = Project.find(@params[:id])
flash[:attachment_error] = “Error at Upload”
redirect_to :action => “edit_project”, :id => project


def attachment=(attachment_field) = base_part_of(attachment_field.original_filename)
self.content_type = attachment_field.content_type.chomp =

def base_part_of file_name
name = File.basename(file_name)
name.gsub(/[^\w._-]/, ‘’)


<%= form_tag({:action => ‘upload_attachment’, :id => @project},
:multipart => true ) %>

Title: <%= text_field(“attachment”,“title”) %> <%=
file_field(“attachment”,“attachment”) %>

<%= submit_tag (“Upload”) %>
<%= end_form_tag %>

Now the PROBLEM: What have I to write to get a multiple file upload, for
example 5 files with one click on the Upload-Button. Is there anyone who
knows something?

Thank you very much!

My english is not the best, but I hope everything is understandable - if
not, please ask.


There a a bunch of them all over the internet. You just need to find
out more about them and decide which one suits your needs.

Here are a few that I can name by mind: Acts As Attachment, File
Column Plugin and FlexImage, attachment_fu, upload_column and many

Try googling the plugins I gave you…

See ya
Thiago G.

On 22 Dec 2007, at 19:06, B wrote:

I want to do a multiple file upload with Ruby. I want to let my users
upload pictures on my website to their account. I’m looking for
something with a nice interface. I was wondering if you knew of any
plugins/gems i can use

Interface is something you have to whip up yourself. Rails isn’t a
ready-made application, it’s a framework. Although maybe one of the
open source rails application might fit your need, I’ll let other
people recommend you apps that could be useful.

On the Rails side, I’d advise you to use attachment_fu to handle the
uploaded files. For the uploading interface, you have a choice
between a wide variety of methods: SWFUpload (http:// uses Flash to stream multiple files to Rails (+
upload progress/client side file size and type checking/…),
reponds_to_parent uses the iframe method for handling uploads
(posting the files form to an iframe to simulate ajax upload) or you
can just use normal forms to handle your upload.

Best regards

Peter De Berdt

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs