Re: Help downloading a file

[email protected] (Greg Jetter)
Newsgroups perl.beginners.cgi
Organization Lazy Mountain Computers
Message-ID <[email protected]>
On Tuesday May 1 2007 6:56 am, Moon, John wrote:
> Below is code I presently use to download to clients and the generated
> html. One client objects to the generated html - the
> "Content-Disposition" ... Does any one have another method to download
> AND display the pdf with perl.
>
>
> sub Display_PDF {
>     my ($pdf, $pdf_size) = @_;
>     $|=0;
>     print $q->header(-type=>'application/pdf',
>         -attachment=>'Requested_Report.pdf',
>         -Content_length=>$pdf_size,
>         -expires=>'+1d',
>         -status=>'200 OK');
>     open REPORT, $pdf;
>     while (read REPORT, my $buff, 5000) {
>         print $buff
>         }
>     }
>
> Generates:
>
> Status: 200 OK
> Expires: Wed, 02 May 2007 14:53:53 GMT
> Date: Tue, 01 May 2007 14:53:53 GMT
> Content-Disposition: attachment; filename="Requested_Report.pdf"
> content-length: 92455
> Content-Type: application/pdf
>
> John W Moon

are you using CGI.pm ?

Greg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.