On 15 Jan 2009, at 03:48, sarah wrote:

> I'm working on a rails app with a flash application in it, and the
> flash application posts binary data to the rails app, to create and
> upload an image. The image arrives from Flash with a  Content-Type of
> "application/octet-stream", but by the time the image data hits the
> controller action, it is a string.

That's merely because of the filesize of the data you are sending.  
Everything below 16KB will be seen as StringIO, above it will be a  
TempFile. Attachment_fu has everything in place to handle it.

Look at line 303 at 
http://github.com/technoweenie/attachment_fu/blob/743a95be0f01696530f558e7f4934cc7e57d3ab8/lib/technoweenie/attachment_fu.rb

> I have googled and found numerous solutions for similar cases: getting
> the content_type of data uploaded from flash (generally via swfobject)
> and adjusting for when the content-type is application/octet-stream.
> But, these don't work in my case -- I'm guessing that all those cases
> are for actually uploading files rather than transporting binary
> data.

Attachment_fu combined with mimetype_fu work perfectly for me with any  
data sent from Flash. Flash has no way to pass in the appropriate  
content type (simply said: it's always application/octet-stream), but  
I can see in your controller that you have a filename available  
(xxxx.jpg). This should be enough for mimetype_fu to determine the  
content-type as "image/jpeg".


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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to