On 15 Jan 2009, at 19:55, sarah wrote:
> What is happening for us is that I am able to get the content-type as
> "image/jpeg" using mimetype_fu, but that is as far as things go. If I
> then try to save that data in the controller (using attachment_fu),
> like so:
>
> image_params = {:uploaded_data => params['image_uploaded_data']}
> image = @visual_note.build_image(image_params.merge(:created_by =>
> current_user))
> if image.valid?
> #do stuff
> else
> #errors
> end
>
>
> Errors are thrown because file_data -- the string passed in through my
> params[:image_uploaded_data] from Flash does not respond to
> content_type or original_filename
>
> ***
>
> Am I missing something from the point where the I am receiving the
> data in the controller and getting it to attachment_fu? It doesn't
> know it is application/octet-stream because it doesn't respond to
> content-type at the controller level.
How about:
image_params = {:temp_data => params['image_uploaded_data'],
:filename => "whateveruwant",
:content_type => "image/jpeg"
}
image = @visual_note.build_image(image_params.merge(:created_by =>
current_user))
if image.valid?
#do stuff
else
#errors
end
Means the data that comes from Flash will be processed and you
manually set the other fields.
Best regards
Peter De Berdt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---