In sr_documents/form:
<%= simple_form_for @service_request,:url=>upload_document_path(@service_request.id),:remote=>true,:html => { :multipart => true } do |f| %>
<%= f.nested_fields_for :sr_documents do |q| %>
<%= q.input :file,:required => true,:hint=>"(only .pdf,.docx,.doc,.txt)", multiple: true,:name=>'file[]' %>
<%= f.button :submit ,:class=> "btn btn-go button",data: {"disable-with" => "Processing..."}%>
<%= f.add_nested_fields_link :sr_documents,"Add new file" %>
<%end%>
I use the gem nested_form_fieldsand paperclipin its application. With the above code, I can upload multiple files. But I'm worried about how to upload multiple files using one file_uploader. I used the name file[]and :multiple=>true, but still does not work. Please help me.
source
share