Multiple File Uploads

Hey, I’m looking for a good and complete how to to implement multiple
file uploads in a form. I’ve been looking for hours now, trying a few
snippets or bits or various forums, and I’d love it if someone who had
a real good grasp on ruby could show me (and everyone else) a ruby way
to implement it. so far all I’ve found is hacks that don’t really
work. I’m familiar with file_column, acts_as_attachment, and
attachment_fu and have gotten all of them to work with one file. I’ve
even tried combing through mephisto’s code, but i can’t make what Rick
does there work.

Any help would be awesome.

This’d be great to know! Any recommendations?

On 3/13/07, plewizard [email protected] wrote:

Any help would be awesome.


Ramon Miguel M. Tayag

plewizard wrote:

Hey, I’m looking for a good and complete how to to implement multiple
file uploads in a form. I’ve been looking for hours now, trying a few
snippets or bits or various forums, and I’d love it if someone who had
a real good grasp on ruby could show me (and everyone else) a ruby way
to implement it. so far all I’ve found is hacks that don’t really
work. I’m familiar with file_column, acts_as_attachment, and
attachment_fu and have gotten all of them to work with one file. I’ve
even tried combing through mephisto’s code, but i can’t make what Rick
does there work.

Any help would be awesome.

Use flash and make your life simple :smiley:

True…

http://blog.vixiom.com/2006/09/08/multiple-file-upload-with-flash-and-ruby-on-rails/

On 3/14/07, Jamal S. [email protected] wrote:

Use flash and make your life simple :smiley:


Ramon Miguel M. Tayag

hey, acts as attachment handles multiple file uploads easily…

here is what you do…

2 models…article and photo…article has_many photos and photo
belongs_to article. create your aaa model and include the article_id in
the photo table. next when you create your form, instantiate more
dvd_covers. like dvd_cover1 = Photo.new…dvd_cover2 = Photo.new…

now in your form, add the newly created file fields. when your in the
submit action build it how you would a has_many relationship. something
like

myarticle = Article.new

myarticle.build_photo(params[:dvdcover1_uploaded_data])
myarticle.build_photo(params[:dvdcover2_uploaded_data])

etc…

i will post the write up in my blog at railsgrunt.com when i get home.