in reply to Re^2: Content-Disposition... odd behavior in IE
in thread Content-Disposition... odd behavior in IE

Perhaps capitalization matters?
#!/usr/bin/perl use strict; print "Content-type: application/octet-stream\n"; print "Cache-Control: private\n"; print "Content-Disposition: attachment; filename=big-test.csv\n\n"; print "Test,One,Two,Three\n"; exit;
Update: And if that doesn't work, perhaps
#!/usr/bin/perl use strict; print "Pragma: \n"; print "Cache-Control: \n"; print "Content-Disposition: attachment; filename=\"big-test.csv\"\n"; print "Content-type: application/octet-stream\n\n"; print "Test,One,Two,Three\n"; exit;
(It is frustrating that I can't test these suggestions, but I don't have IE to test with and it is a browser issue.)

Replies are listed 'Best First'.
Re^4: Content-Disposition... odd behavior in IE
by ikegami (Patriarch) on Jan 14, 2009 at 18:50 UTC

    Perhaps capitalization matters?

    Capitalisation is not suppose to matter for HTTP header names (but you never know), and you already rely on the case-insensitivity (by using "Content-type" instead of "Content-Type").

      Ah. I was just copying an example from somewhere.

      Really my experience with this kind of problem is that you keep trying variations that have worked for someone else and hopefully one of them finally does the trick.

      Glancing at some code I have lying around the following definitely works with many people's copies of IE:

      #! /usr/bin/perl -w use strict; use CGI; print CGI->header( -type => "application/vnd.ms-excel", -attachment => "example.xls", ); print "Salutation\tRecipient\nHello\tWorld\nGreetings\tEarthlings\n";
      So if that doesn't work I can guarantee that the problem is specific to his copy of IE, and is not shared by IE in general.
        I just tested this on a few machines and works on some but not others.

        I agree 100% the problem is specific to a copy of IE (mine or otherwise). But, at best it's a crap shoot and I need more reliability than that.

Re^4: Content-Disposition... odd behavior in IE
by Rodster001 (Pilgrim) on Jan 14, 2009 at 18:39 UTC
    Still no luck.

    After playing around with the cache idea in mind, I have noticed if the helper app is open the file opens sometimes (worked with Excel, but not Acrobat).

    This is confirmed with looking for files created in the cache folder.

    IE is either deleting or not creating the file in the cache.

      I would suggest trying another machine and seeing if it works. I would also recommend looking at your local browser settings and seeing whether IE has some preference set that could adversely affect its caching behavior.

      Good luck and welcome to the world of frustration and pain that is Microsoft.