Topic: Multiple Photo Upload using Jquery and Paperclip

I would like to have a photo upload page that allows users to select multiple photos in the same file dialog. I have found the following solution http://valums.com/ajax-upload/, which is exactly what I want. This solution sends each file as a separate post request one by one. It uses xhr, which I am not very familiar with.

I can get it to call the proper action and controller, but I cannot get it to provide all the parameters that Paperclip requires. When using Paperclip I believe you need to specify that it is a multipart form. I don't think that this solution sends multipart forms and I don't know how I would go about getting it to do that without a lot of research.

Here are all the params that Paperclip expects when you submit a form. This is a piece of an actual post on one of my forms. I use a Photo model that also has an attachment called 'photo'.

“photo”=>{“photo”=>#<ActionDispatch::Http::UploadedFile:0x7f2a00c97e18 @original_filename="myphoto.jpg", @tempfile=#, @headers=”Content-Disposition: form-data; name=\”photo[photo]\”; filename=\”myphoto.jpg\”\r\nContent-Type: image/jpeg\r\n”, @content_type=”image/jpeg”>

Last edited by ecoulthard (2011-03-22 10:33:42)