Forum: Ruby on Rails How to make attachment_fu work?

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.
Aed326335b876b6baf65016450c00cfa?d=identicon&s=25 Mister Yu (Guest)
on 2007-07-26 04:01
(Received via mailing list)
Hi all,

I downloaded and installed attachment_fu, also i followed mike clark's
tutorial from here

but when i tried to upload a file, there are these error msgs:
5 errors prohibited this photo from being saved

There were problems with the following fields:

    * Content type is not included in the list
    * Content type can't be blank
    * Size is not included in the list
    * Size can't be blank
    * Filename can't be blank

actually, this has been mentioned before, but i didn't see any

here's my new.rhtml:
<%= error_messages_for :photo %>

<% form_for(:photo, :url
=>{:controller=>"photo", :action=>"create"} , :html => { :multipart =>
true }) do |f| -%>
    <label for="photo">Upload A Photo:</label>
    <%= f.file_field :uploaded_data %>
    <%= submit_tag 'Create' %>
<% end -%>

and here's the ACTUAL html file it returns:

<form action="/photo/create" enctype="multipart/form-data"
method="post">  <p>
    <label for="photo">Upload A Photo:</label>
    <input id="photo_uploaded_data" name="photo[uploaded_data]"
size="30" type="file" />
    <input name="commit" type="submit" value="Create" />


the "name" is actually "photo[uploaded_data]" but not upload_data, how
do i fix this?

5635e2fe13ed1c423962f5683fede3c0?d=identicon&s=25 Andrew Kuklewicz (Guest)
on 2007-07-26 04:51
(Received via mailing list)
The name "photo[uploaded_data]" is fine, view looks fine, what does your
controller and model look like?

You have validation errors - so what are you validating in the model?
Your controller does not appear to be creating the object correctly
the fields aren't getting populated), so what does it look like?


On 7/25/07, Mister Yu <> wrote:
> There were problems with the following fields:
> here's my new.rhtml:
>     <%= submit_tag 'Create' %>
>   </p>
> >

Andrew Kuklewicz
This topic is locked and can not be replied to.