# Attachment\_fu content\_type problem

**URL:** <https://www.ruby-forum.com/t/attachment-fu-content-type-problem/93130>\
**Category:** Rails\
**Created:** [April 27, 2007, 11:59pm UTC](https://www.ruby-forum.com/t/attachment-fu-content-type-problem/93130 "2007-04-27T23:59:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [April 27, 2007, 11:59pm UTC](https://www.ruby-forum.com/t/attachment-fu-content-type-problem/93130/1 "2007-04-27T23:59:27Z")

</div>

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

validates\_as\_attachment

end
