Closed hallmatt closed 9 years ago
I suspect this is fallout from https://github.com/rails/rails/commit/488699166c3558963fa82d4689a35f8c3fd93f47
See
- options["name"] += "[]" if options["multiple"]
+ options["name"] += "[]" if options["multiple"] && !options["name"].ends_with?("[]")
Turns out, downgrading rails to 3.2.12 doesn't solve this. Going to 0.4.0 for jquery-fileupload-rails + rails 3.2.12 makes this function OK again. (3.2.13 + 0.4.0 doesn't work either.)
As a quick monkey-patch file_field_tag
helper can be used with Rails 3.2.13
and jquery-fileupload-rails 0.4.1
. It can accept custom name
attribute without adding []
to it like:
<%= file_field_tag(:image, multiple: true, name: "machine_image[image]") %>
Same happens to me, using rails 3.2.13
and jquery-fileupload-rails 0.4.17
when using multiple uploads it breaks. when I try to upload without multiple selection it works ok
Same for me, not working with multiple true, Rails 3.2.13.
:+1:
Adding this to my js works for me:
$('#fileupload').fileupload({ paramName: 'yourModel[fieldName]' });
Just remember to change the name accordingly (for me it was ''profile[avatar]'. This way you avoid adding the []s to the param's name
@euomarcelo :+1:
@euomarcelo thanks, also worked for me
@euomarcelo thanks. It worked !!!
thanks worked for me to example: $('#fileupload').fileupload({ paramName: 'website_page[websiteimages_attributes][0][websiteimage]' });
@tors This ticket can be closed.
I'm using the multiple option to choose an upload multiple photos, which works fine in Rails 3.2.12, but once I upgrade to 3.2.13 the functionality fails. However, if I remove the multiple: true option in the form helper, it also uploads images fine...but this multiple option is a necessity (unfortunately).
I'm using Paperclip to handle the files and receive an error in the logs stating: Paperclip::AdapterRegistry::NoHandlerError - No handler found for [#<ActionDispatch::Http::UploadedFile:0x007fdb5d070888 @original_filename="C70476_File002_Large.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"machine_image[image][]\"; filename=\"C70476_File002_Large.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/2c/2hqcq4k55g1_v_h447vn96q40000gn/T/RackMultipart20130319-14961-7i2zm1>>]
Any thoughts on this? I'm not sure if this is a Paperclip or a jQuery Fileupload-Rails issue . Here's my form:
Here's my Javascript/Coffeescript:
Any help or direction on this would be greatly appreciated. Thanks!