使用JQuery-File-Upload和Paperclip时出现多个文件上载错误

时间:2012-06-20 18:09:17

标签: jquery ruby-on-rails-3 paperclip

使用tutorial在Rails中的多个文件上传jQuery-File-Upload后,只要属性:multiple =>就会出现问题true 被添加到file_field,例如

<%= f.file_field :path, :multiple => true %>

发生以下错误:

Started POST "/pictures" for 127.0.0.1 at 2012-06-20 18:50:51 +0100
Processing by PicturesController#create as JSON
Parameters: {"utf8"=>"✓", "authenticity_token"=>"hcMORNvY1Rx/tbHv8wB+hLKzS92Nez5qHdgHXfcq+Nc=", "picture"=>{"path"=>[#<ActionDispatch::Http::UploadedFile:0x007fa183ba1a18 @original_filename="001.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"picture[path][]\"; filename=\"001.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/xq/dq4fkqnx0m36htfgdj2lxlb00000gn/T/RackMultipart20120620-60459-yeso39>>]}}
Completed 500 Internal Server Error in 1ms

Paperclip::AdapterRegistry::NoHandlerError (No handler found for [#<ActionDispatch::Http::UploadedFile:0x007fa183ba1a18 @original_filename="001.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"picture[path][]\"; filename=\"001.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/xq/dq4fkqnx0m36htfgdj2lxlb00000gn/T/RackMultipart20120620-60459-yeso39>>]):
app/controllers/pictures_controller.rb:14:in `create'

有没有人遇到过这个问题的解决方案?

Rails:3.2.5,Paperclip:3.1.2,浏览器:Chrome版本19.0.1084.56,操作系统:Mac OS X 10.7.4

1 个答案:

答案 0 :(得分:0)

我一直在做同样的事情,但没有倍数=&gt;对于文件字段为true。您将无法使用文件浏览器对话框一次选择多个图像,但只要您不使用IE,您仍然可以一次拖放多个文件并且完美无缺。

我没有在对话框中选择多个文件,但是一旦你完成剩下的设置工作,这只是一个小问题。

相关问题