Maniacal Monks,

I must first admit that this is a Perl question only insofar as it is a Perl scriupt producing the output that is causing problems. The problem MAY have nothing to do with the Perl script producing the output.

I have two Perl download scripts that get a Powerpoint file from the server, preceed it by a header, then write out the file line by line. The file headers tell the browser what kind of file it is and what its disposition is. The scripts run on different servers, both UNIX boxes. The important part of the scripts - the file getting, header attaching and file downloading parts - are identical. One script is in fact a copy of the first with the only difference being how the script assembles the output file name.

The headers are intended to, and for some time have successfully, cause MSIE to open the PPT in a new, separate instance of PowerPoint on the user's machine. That is, NOT in the browser. As I said, this has worked perfectly for both scripts for months for dozens of users with various configurations.

The Problem - a user who is running Windows XP, the first I know of, reports that files downloaded from script 1 open as intended, but files downloaded via script 2 on the other server open in the browser. With identical file headers, this is a great mystery, and causes all sorts of functionality problems.

Here are the salient partrs of the script:

$download_filetype = '.ppt'; open(FILE, $template) or dienice("cannot open file $template : $_[0] $ +!"); @LINES = <FILE>; close(FILE); $filename = join('_', $session_id, $download_filetype); print "Content-type: application/vnd.ms-powerpoint\n"; print "Content-Disposition: attachment; filename=$filename\n\n"; for $i (0..$#LINES) { print $LINES[$i]; }

Any ideas will be most welcome.

Forget that fear of gravity,
Get a little savagery in your life.


In reply to 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.