Undefined method `content_type'

I am using form_remote_tag to upload a file, but it says …

undefined method `content_type’ for #String:0x477a930

what could be wrong when it works fine with form_for?

You can’t upload via XMLHTTPRequest. :frowning: Javascript does not have
access to local files on your computer for security purposes.

Take a look at this post:

On Dec 31 2007, 3:57 am, “Vapor …” [email protected]

You can use an Iframe for stuff like this.

Assuming you’re already using attachment_fu, you also need to use
responds_to_parent to allow for remote uploading.

Check out:
http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent

  • Best tutorial that covers this :slight_smile:

On Dec 31 2007, 9:57 pm, “Vapor …” [email protected]