views:

11

answers:

1

Hi, I want to know how to upload files(other than images) using attachement_fu plugin in rails. I successfully uploaded images using attachement_fu, but wasn't able to upload other kinds of files.

A: 

Can you give a code example of how you configure your model to accept the attachment?

Basically, to upload types other then images, you need to either omit the :content_type option, or give the correct content type.

So instead of (for example):

has_attachment :content_type => :image, :max_size => 5.megabytes

You need to provide something like:

has_attachment :content_type => 'application/pdf', :max_size => 5.megabytes

or just has_attachment without :content_type (this will accept all types).

Take a look at the attachemnt_fu README for more examples.

Matt