paperclip is not saving the files

Hi all,
              I've installed paperclips but
paperclip is not saving the files

my model has

has_attached_file :attachment,:styles => { :medium => "300x300>",
                                 :thumb => "100x100>" }

and i have db migration as

class AddAttachmentToPolicies < ActiveRecord::Migration
  def self.up
    add_column :policies, :attachment_file_name, :string
    add_column :policies, :attachment_content_type, :string
    add_column :policies, :attachment_file_size, :integer
  end

  def self.down
    remove_column :policies, :attachment_file_name
    remove_column :policies, :attachment_content_type
    remove_column :policies, :attachment_file_size
  end

end

and I have that plugin as well

but its not saving the files and I'm getting values as null in my DB
for the above set feilds

Plz help me in this regard

we probably need to see your controller code first

I'm using form_tag
and i got errors as " /LOCALS~1/Temp/stream.3468.0 is not recognized
by the 'identify' command."
when i hit submit

Things to check:

  • your form_tag has :multipart set to true

  • imagemagick is installed and compiled properly

  • imagemagick is in the default load paths of your linux distro or specify the path explicitely

  • imagemagick has the necessary processor for the filetype you are uploading installed

  • the file you are uploading is effectively and at all times an image (if you want to upload non-thumbnailable files, you’ll need to handle that using a “before_post_process” method that determines what processor to use for what filetype

thankyou Peter ,

can you just tell me how to install imagemagick in windows

Not doing it very often, but here you go:

http://lmgtfy.com/?q=install+imagemagick+windows
http://lmgtfy.com/?q=paperclip+imagemagick+windows

Thanks,

this thread was rather timely for me (just in before a deadline). I
was facing exactly the same thing and had left off the multi-part bit
in the form.

Cheers,
Jeremy

Kart wrote:

class AddAttachmentToPolicies < ActiveRecord::Migration
  def self.up
    add_column :policies, :attachment_file_name, :string
    add_column :policies, :attachment_content_type, :string
    add_column :policies, :attachment_file_size, :integer
  end

I also recommend including:

    add_column :policies, :attachment_updated_at, :datetime

I don't know that this is strictly required, but I found that I needed it when I was getting Paperclip working. I have since included it in several projects now. It wont hurt, and I think it may be required. (I remember that it is not documented.)

-- Will

I've installed image magick.............
but it still shows the error message "/LOCALS~1/Temp/stream.3468.0 is
not recognized
by the 'identify' command.".Is that i need to install it in the
project folder and give me some ways on how to compile it .or any
other gems avilable for this paperclip to work.
i'm in urgent need

Plz help me in this regard...

Wasim Akram wrote:

I've installed image magick.............
but it still shows the error message "/LOCALS~1/Temp/stream.3468.0 is
not recognized
by the 'identify' command.".Is that i need to install it in the
project folder and give me some ways on how to compile it .or any
other gems avilable for this paperclip to work.
i'm in urgent need

Plz help me in this regard...

Use this:

has_attached_file :image, :url => "/:attachment/:id_:style.:extension",
:path => ":rails_root/public/:attachment/:id_:style.:extension", :styles
=> { :original => "500x500>" }

Let me know how it goes. I have an working application that you can
download from http://www.classifiedscript.in

Cheers

I'm getting this error for windows setup does this solution work?
Going Gray trying to figure out why I am getting the error.

THanks for your help.

For windows, make sure you close down the rails server and any command
prompt instances and restart them. The imagemagick install path in
program files (the folder containing identify.exe) needs to be
accessible in the PATH variable. To check type echo %PATH% in the
command prompt. If the imagemagick installation folder shows, the
rails app should function.

check it in your system folder in your rails root app , where you can find your uploaded images

Dhana