Your other solution that should work is to set the header directly that IE is parsing, Content-Disposition.
i.e.: headers['Content-Disposition'] = "inline; filename=\"" + @filename + "\"" -Brady [EMAIL PROTECTED] On Sep 16, 12:28 pm, Noel Walters <[EMAIL PROTECTED]> wrote: > Platform = Linux and Mongrel > > I'm using send_file to send images from a controller. like this: > > send_file( @content.location, :disposition => 'inline', :type => > File.mime_type?(@content.location)) # mime_type? courtesy of mimetype_fu > > This is called for in an ordinary <img> tag. > > It all works perfectly except for one minor hitch which is driving me > mad. > > If you right click on the image in IE7 and choose "Save Image As..." the > file save dialog always defaults the filename to "untitled.bmp". > > Other browsers always get the correct file name (usually something like > "61.png" or "18.jpg") > > If I copy the file into the corresponding path under RAILS_ROOT/public > then IE7 will get the filename correct - as will all browsers. > > Interestingly if you do save the file as untitled.bmp it's a perfectly > good bmp file. > > The HTTP headers set by mongrel differ substantially from the ones set > by send_file. > > Using send_file gives: > > Status=OK - 200 > Date=Tue, 16 Sep 2008 18:16:59 GMT > Server=Mongrel 1.1.4 > Vary=Host > Status=200 OK > X-Runtime=0.01416 > Content-Transfer-Encoding=binary > Cache-Control=private > Content-Disposition=inline; filename="16.jpg" > Content-Type=image/jpeg > Content-Length=164553 > X-Cache=MISS fromwww.sharehost.co.uk > Keep-Alive=timeout=15, max=100 > Connection=Keep-Alive > > Serving the file from the public area gives: > > Status=OK - 200 > Date=Tue, 16 Sep 2008 18:17:09 GMT > Vary=Host > Etag="48cfb25c-65c2f-918190" > Last-Modified=Tue, 16 Sep 2008 13:19:24 GMT > Content-Type=image/jpeg > Content-Length=416815 > X-Cache=MISS fromwww.sharehost.co.uk > Keep-Alive=timeout=15, max=99 > Connection=Keep-Alive > > Anybody know what I can do about this? > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

