Hello!

This posting is somewhat of a continuation of this thread.

To summarize, when the attachment header is sent to IE choosing "save" from the dialogue box works but "open" sometimes (depending on the system) results in the file "not found". This has something to do with the cache in IE (I believe).

The update is that Google's analytics site has a pdf export option for each of its report pages. This works flawlessly (choosing open or save when prompted by the dialogue box). I am guessing that Google is sending something else in the header which I am not that is making theirs work. But, since the site is secure and requires a form based login I can't easily see the header they are sending (by telneting to port 80 for example).

This is my code snippet that is not working.

use CGI; my $f; open (OUT,"somefile.pdf") or print STDERR "Can't open $!"; while (<OUT>) { $f .= $_; } close (OUT); my $l = length($f); print CGI->header( -type =>"application/octet-stream", -expires=> '+3d', -charset=>'utf-7', -Content_length => $l, -attachment => "example.pdf", ); print $f; exit;
Any ideas? Thanks!

In reply to HTTP Attachment Header by Rodster001

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.