I have a page which i can add attachments. I wanted to add multiple files during browsing so i added the :multiple => true method on my input, so it looks like this during this input: f.has_many :attachments
f.input :file , :input_html => { :multiple => true }
For multiple attachments to be added / seen on the attachment panel i have this:
attachment=[]
(0..params[:kayako_client_ticket][:attachment].count-1).each do |f|
attachment << {:filename => params[:kayako_client_ticket][:attachment]
[f].original_filename,:data => File.new(params[:kayako_client_ticket]
[:attachment][f].tempfile).read}
end unless params[:kayako_client_ticket][:attachment].blank?
In my model file, attachments are referenced like this:
has_many :attachments, :as => :attachable, :dependent => :destroy
And if I add multiple files , i get this error :
You are not allowed to upload nil files, allowed types: jpg, jpeg, gif, png, doc, docx, xls, xlsx, xlsb, csv, txt, ppt, pptx, pps, ppsx, pdf, xpf
What do you recommend me to do in this situation?
PS: Thanks for your future answers.