2

paperclip GEM の使用中に次のエラーが発生します。JPG/PNG をアップロードしようとしましたが、どちらも機能しません。検証エラーが発生しているようです..何か助けていただければ幸いです。

Image has contents that are not what they are reported to be

class Listing < ActiveRecord::Base
     has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "404.jpg"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
end
4

2 に答える 2

1

Windows 7 開発モードで使用している場合。file.exe を手動でインストールし、パスを設定する必要があります。file.exe を手動でインストールするリンクの内容に従ってください 。

インストール後

環境

  1. 開けるconfig/environments/development.rb
  2. 次の行を追加します。Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'
  3. Rails サーバーを再起動します。
于 2015-12-26T00:07:29.063 に答える