Search code examples
ruby-on-rails-4paperclippaperclip-validation

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


I am getting the following error while using the paperclip GEM.I have tried uploading JPG/PNG and neither works. It seems like I am getting validation error..any help would be awesome thanks!

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

Solution

  • If your are using in windows 7 development mode. U need to manually install file.exe and set the path. Please follow the content in the link installing file.exe manually.

    After installing

    Environment

    1. Open config/environments/development.rb
    2. Add the following line: Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'
    3. Restart your Rails server