If I ever needed a reason to $!@%$ a Microsoft Employee in the $!@%, IE for XP is many good reasons.

Microsoft appear to have made XP less standards-compliant than earlier versions of IE.. one of the things that has tripped me up is the necessarity of making the server tell the browser that pages may be cached, otherwise IE for XP will refuse to download the file to open.

Your use of the Content-Disposition: attachment; appears to be correct so I'm puzzled as to why the IE browser isn't opening in a new window. Just as an aside I would do two new things in your script:

1. add a Content-Length: $bytes line so that your browser can estimate how long the download will take.

2. read the file in using read instead of <FILE> as it is a binary file without record separators.. e.g.

my $template = "filename.ppt"; my $fsize = ( stat( $template ) )[7]; if ( ! open( FILE, "<$template" ) ) { die( "Cannot open $template, $!" ); } print( "Content-Disposition: attachment; filename=\"$template\"\n" ); print( "content-type: application/vnd.ms-powerpoint\n" ); print( "Content-Length: $fsize\n" ); print( "\n" ); my ( $result, $data ); while ( $result = read( FILE, $data, 8192 ) ) { print( $data ); } close( FILE );

In reply to Re: Different client-side behaviours from two theoretically identical download scripts. by monarch
in thread Different client-side behaviours from two theoretically identical download scripts. by punch_card_don

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.