Christian Benincasa
Christian Benincasa

Reputation: 1215

Ruby: Multiple file upload using multipart/form-data

I'm extremely new to Ruby and Ruby on Rails, but am developing on top of an existing framework. I am attempting to upload multiple files to the server using "multipart/form-data". When I select multiple files for upload, only the last files selected goes through and actually gets uploaded. Here is a sample request payload:

------WebKitFormBoundarybQW0C702DEMnqySc
Content-Disposition: form-data; name="file"; filename="test 2.txt"
Content-Type: text/plain


------WebKitFormBoundarybQW0C702DEMnqySc
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain


------WebKitFormBoundarybQW0C702DEMnqySc--

I'm sure that single file upload works using this notation, but I am wondering if there is a native way to do multiple file upload in this format. Should I cycling through this data somehow? I'm at a loss with this because I am extremely unexperienced with Ruby/Rails.

I need to support IE9 here, so I can't really do any manipulation with the FormData object..

Upvotes: 0

Views: 1393

Answers (1)

Erik Petersen
Erik Petersen

Reputation: 2357

Take a look at this https://github.com/valums/file-uploade

Upvotes: 1

Related Questions