2

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
westman2222
  • 663
  • 1
  • 12
  • 30

2 Answers2

1

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
arun kumar
  • 40
  • 4
0

This worked for Windows 8:

1.Download file.exe

2.Test if is well installed by running your cmd and put the following instructions
convert logo: logo.miff then run imdisplay logo.miff

You will get custom logo image,that will pop up on your windows screen. From here now you can start configuring everything on rails app

Open config/environments/development.rb

Add the following line: Paperclip.options[:command_path] = 'C:\tools\GnuWin32\bin' If your rails server is currently running,brake the server and then run again rails s.After that you should be ready to go.Upload image on your app.

Hunter
  • 3,080
  • 20
  • 23