# Problem with attachment\_fu

**URL:** <https://www.ruby-forum.com/t/problem-with-attachment-fu/90403>\
**Category:** Rails\
**Created:** [March 28, 2007, 2:13pm UTC](https://www.ruby-forum.com/t/problem-with-attachment-fu/90403 "2007-03-28T14:13:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tino\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a183cd/32.png) [@Tino\_B](https://www.ruby-forum.com/u/Tino_B)\
**Post date:** [March 28, 2007, 2:13pm UTC](https://www.ruby-forum.com/t/problem-with-attachment-fu/90403/1 "2007-03-28T14:13:23Z")

</div>

Hi,

i started to test attachment\_fu, but i can’t get it to upload a file.  
See  
the error:

NoMethodError (undefined method `content_type' for "/100_2261.jpg":String): /vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:244:in`uploaded\_data=’

I looked at the plugin code, but can’t figure out how to fix this issue.  
I’d  
appreciate any help.

Bye,  
Tino

---

<div class="post-metadata">

**Author:** ![Tino\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a183cd/32.png) [@Tino\_B](https://www.ruby-forum.com/u/Tino_B)\
**Post date:** [March 28, 2007, 2:17pm UTC](https://www.ruby-forum.com/t/problem-with-attachment-fu/90403/2 "2007-03-28T14:17:31Z")

</div>

On 3/28/07, Tino B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I looked at the plugin code, but can’t figure out how to fix this issue. I’d  
> appreciate any help.

Your form needs to be a multipart form. Use :multipart =\> true.

[http://rails.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M000601](http://rails.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M000601)

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![Tino\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a183cd/32.png) [@Tino\_B](https://www.ruby-forum.com/u/Tino_B)\
**Post date:** [March 28, 2007, 2:35pm UTC](https://www.ruby-forum.com/t/problem-with-attachment-fu/90403/3 "2007-03-28T14:35:13Z")

</div>

I use the following form snippet:

form\_remote\_for(:image, :url =\> images\_path, :html =\> {:multipart =\>  
true} ,  
:update =\> “image”) do |f|

And it is compiled to a multipart form as far as i see in my html code.

---

<div class="post-metadata">

**Author:** ![Tino\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a183cd/32.png) [@Tino\_B](https://www.ruby-forum.com/u/Tino_B)\
**Post date:** [March 28, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/problem-with-attachment-fu/90403/4 "2007-03-28T20:37:13Z")

</div>

He, now it’s working. Thank you Raja. For the first contact with  
attachment\_fu I will avoid using AJAX forms for such a scenario.

Tino

---

<div class="post-metadata">

**Author:** ![Tino\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a183cd/32.png) [@Tino\_B](https://www.ruby-forum.com/u/Tino_B)\
**Post date:** [March 28, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/problem-with-attachment-fu/90403/5 "2007-03-28T19:51:05Z")

</div>

You can’t use AJAX forms (form\_remote\_for uses a for file upload  
calls a XMLHttpRequest via the prototype js lib) with file uploads.  
Alternate methods for inline uploads utilize hidden forms.

raja
