Forum: Ruby on Rails attachment_fu content_type problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mark S. (Guest)
on 2007-04-28 01:59
(Received via mailing list)
Hi all....

Admittedly I'm new to Rails and trying to find my way but I'm having
an issue with uploading documents with attachment_fu.

I have a form where I'm uploading multiple attachments (using AJAX to
add file_filed_tags).  That seems to work pretty well.  The problem is
I can't seem to get the content_type to work as I would expect.  For
example, if I use this:

has_attachment :content_type => ['application/pdf', 'application/
msword', 'text/plain']

I would expect I can upload .pdf, .doc and .txt files but I get and
Document is invalid error (document is the name of my model)  I have
played around with different content_types but I can't seem to get
consistent results.

Thanks for any help.

- Mark

Here is the document model

class Document < ActiveRecord::Base
  belongs_to  :tournament, :polymorphic => true

  has_attachment :content_type => ['application/pdf', 'application/
msword', 'text/plain'],
                 :storage => :file_system,
                 :max_size => 1.megabyte


This topic is locked and can not be replied to.