Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails回形针img上载错误:“0”;“未选择任何文件”;安装了rmagick_Ruby On Rails_Paperclip_Rmagick_Image Upload - Fatal编程技术网

Ruby on rails Rails回形针img上载错误:“0”;“未选择任何文件”;安装了rmagick

Ruby on rails Rails回形针img上载错误:“0”;“未选择任何文件”;安装了rmagick,ruby-on-rails,paperclip,rmagick,image-upload,Ruby On Rails,Paperclip,Rmagick,Image Upload,我无法使用回形针上传图像。每当我选择文件并提交时,页面会重新加载并显示“未选择文件” 我的代码trip.rb class Trip < ActiveRecord::Base has_many :images accepts_nested_attributes_for :images, :allow_destroy => true attr_accessible :messages_attributes end 将-gem“

我无法使用回形针上传图像。每当我选择文件并提交时,页面会重新加载并显示“未选择文件”

我的代码trip.rb

    class Trip < ActiveRecord::Base
       has_many :images
       accepts_nested_attributes_for :images, :allow_destroy => true
       attr_accessible :messages_attributes
    end 
将-
gem“cookine”,“0.3.2”
添加到gemfile解决了这个问题


此处提供更多信息-

作为调试步骤,您是否尝试从console创建映像,而不使用(嵌套)表单?e、 g.
Image.create:Image=>File.open('my_img.jpg')
如果是这样的话,那就行了吗?不,那不行!查看更新。然后至少我们知道表单不是问题;)嗯,我不太熟悉ruby on windows,但从您的错误来看,它似乎在临时目录中创建文件或从临时目录中读取文件时遇到了问题,在我看来,这不像是rmagick问题。恐怕我不能告诉你为什么。希望有更多windows经验的人能够发表评论。仅供参考,回形针不使用rmagick,只使用ImageMagick。您可以尝试一些更基本的方法来缩小问题的范围,例如直接通过曲别针执行
identify
convert
,例如
paperclip.run(“identify file/name.jpg”)
。另外,当您试图弄清楚这一点时,请对AmazonS3进行注释。您是否在操作系统下安装了rmagic本机库?
    <%= f.fields_for :images do |image_fields| %> 
       <% if image_fields.object.new_record? %> 
         <%= image_fields.file_field :image %>  
       <% end %> 
    <% end %>
    class Image < ActiveRecord::Base
     belongs_to :trips

     has_attached_file :image, :styles => { :large => "640x480", :medium => "300x300>", :thumb => "100x100" },
     :storage => :s3,
     :bucket => 'Thrill',
     :s3_credentials => {
       :access_key_id => 'XXXXXXXXXXXX',
       :secret_access_key => 'xxxxxxxxxxxxxxxxxxxxx'
     }
    end
 identify.exe: unable to open image `AppData/Local/Temp/stream20120826-41544-1no4
 vdp.jpg': No such file or directory @ error/blob.c/OpenBlob/2641.
 identify.exe: unable to open image `AppData/Local/Temp/stream20120826-41544-1no4
 vdp.jpg': No such file or directory @ error/blob.c/OpenBlob/2641.
 identify.exe: unable to open image `AppData/Local/Temp/stream20120826-41544-1no4
 vdp.jpg': No such file or directory @ error/blob.c/OpenBlob/2641.
 => #<Image id: nil, image_file_name: "srf.jpg", image_content_type: "image/jpeg"
 , image_file_size: 142825, image_updated_at: "2012-08-26 19:28:19", trip_id: nil
 , created_at: nil, updated_at: nil, title: nil, location_id: nil>