ruby on rails - Paperclip::AdapterRegistry::NoHandlerError when use krajee bootstrap file input -
i using krajee bootstrap file input uploading multi files in rails. got paperclip::adapterregistry::nohandlererror after click upload button. can me. thanks
class workfile < activerecord::base has_attached_file :attachment, :styles => { :small => "150x150#"}, :url => "/assets/work_files/:id/:style/:basename.:extension", :path => ":rails_root/app/assets/images/work_files/:id/:style/:basename.:extension" validates_attachment_content_type :attachment, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"] validates_attachment_size :attachment, :less_than => 1.megabytes end
class workfilescontroller < applicationcontroller def upload @wf = workfile.new @wf.attachment = params[:pm_file_upload] @wf.save end end started post "/work_files/upload" 192.168.0.5 @ 2016-02-02 21:51:17 +0000 processing workfilescontroller#upload json parameters: {"pm_file_upload"=>[#<actiondispatch::http::uploadedfile:0x55acb48 @tempfile=#<file:/var/folders/bc/bcjs3dcdgoa9n-zhecdrnu+++ti/-tmp-/rackmultipart20160202-44332-wpd4ik>, @original_filename="hello world.pdf", @content_type="application/pdf", @headers="content-disposition: form-data; name=\"pm_file_upload[]\"; filename=\"hello world.pdf\"\r\ncontent-type: application/pdf\r\n">], "file_id"=>"0"} completed 500 internal server error in 10ms paperclip::adapterregistry::nohandlererror (no handler found [#<actiondispatch::http::uploadedfile:0x55acb48 @tempfile=#<file:/var/folders/bc/bcjs3dcdgoa9n-zhecdrnu+++ti/-tmp-/rackmultipart20160202-44332-wpd4ik>, @original_filename="hellow world.pdf", @content_type="application/pdf", @headers="content-disposition: form-data; name=\"pm_file_upload[]\"; filename=\"hello world.pdf\"\r\ncontent-type: application/pdf\r\n">]): app/controllers/work_files_controller.rb:5:in `upload'
change @wf.attachment = params[:pm_file_upload]
@wf.attachment = params[:pm_file_upload][0]
Comments
Post a Comment