I have this app where users can look-up certain information and then save it into a CSV file. My problem is that when a user using IE7 tries to save this file I get an error saying something to the effect that "unable to downlaod because the website could not be contacted," blah blah blah. But, in Chrome and Opera the downloading works fine. stream_csv do |csv| csv << [ "Sort One", "Sort Two", "Sort Three"] @unusedtickets.each do |unusedticket| csv << [ unusedticket.sort1, unusedticket.sort2, unusedticket.sort3,] end end This is the code that makes the CSV file, I don''t know it will help but here it is. Has anyway come across this kind of thing? Thanks, -S -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try to set the headers in the start of your action, something like this: headers['Content-Type'] = "application/vnd.ms-excel" headers['Content-Disposition'] = 'attachment; filename="excel-export.xls"' headers['Cache-Control'] = '' Cheers. [ rui ] [ Seiri, Seiton, Seisō, Seiketsu e Shitsuke ] On Mon, Nov 3, 2008 at 12:58 PM, Shandy Nantz <rails-mailing-list@andreas-s.net> wrote:> > I have this app where users can look-up certain information and then > save it into a CSV file. My problem is that when a user using IE7 tries > to save this file I get an error saying something to the effect that > "unable to downlaod because the website could not be contacted," blah > blah blah. But, in Chrome and Opera the downloading works fine. > > stream_csv do |csv| > csv << [ "Sort One", "Sort Two", "Sort Three"] > @unusedtickets.each do |unusedticket| > csv << [ unusedticket.sort1, unusedticket.sort2, > unusedticket.sort3,] > end > end > > This is the code that makes the CSV file, I don't know it will help but > here it is. > > Has anyway come across this kind of thing? Thanks, > > -S > -- > Posted via http://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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wouldn''t send_data work for this? http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000254 Rui Neto wrote:> Try to set the headers in the start of your action, something like this: > > headers[''Content-Type''] = "application/vnd.ms-excel" > headers[''Content-Disposition''] = ''attachment; > filename="excel-export.xls"'' > headers[''Cache-Control''] = '''' > > Cheers. > > [ rui ] > [ Seiri, Seiton, Seisō, Seiketsu e Shitsuke ] > > > > On Mon, Nov 3, 2008 at 12:58 PM, Shandy Nantz-- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rui Neto wrote:> Try to set the headers in the start of your action, something like this: > > headers[''Content-Type''] = "application/vnd.ms-excel" > headers[''Content-Disposition''] = ''attachment; > filename="excel-export.xls"'' > headers[''Cache-Control''] = '''' > > Cheers. > > [ rui ] > [ Seiri, Seiton, Seisō, Seiketsu e Shitsuke ] > > > > On Mon, Nov 3, 2008 at 12:58 PM, Shandy NantzWhat I ended up doing is adding this line: headers[''Cache-Control''] = ''private'' thanks for the responce, -S -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---