I'm all set, I had to use err_headers_out for some reason so,
$r->err_headers_out->add('Content-Disposition' => 'attachment; filename="' .
$download_name . '"');
Works.
-Chris
From: cfaust-dougot [mailto:cfa...@doyougot.com]
Sent: Sun 1/22/2012 6:20 AM
To: Earle Ake; modperl@perl.apache.org
Subject: RE: Content-Disposition
Thanks for the reply Earle, I actually did try both "attachment" and "inline"
and neither worked (I should have said that in the org post).
-Chris
From: Earle Ake [mailto:e...@woh.rr.com]
Sent: Sat 1/21/2012 9:19 PM
To: cfaust-dougot; modperl@perl.apache.org
Subject: RE: Content-Disposition
I have done it before using something like:
print "Content-Disposition:attachment;filename=$download_name\n";
So maybe try:
$r->header_out( 'Content-Disposition' => 'attachment; filename="' .
$download_name . '"');
From: cfaust-dougot [mailto:cfa...@doyougot.com]
Sent: Saturday, January 21, 2012 7:02 PM
To: modperl@perl.apache.org
Subject: Content-Disposition
Hello,
I'm guessing there is a real simple answer to my question but as uasual, I
can't find it :)
Simply put I'm trying to create a Zip file and push it to the user using a
filename I've defined. Everything works except the name of the file that comes
up in the browser dialog. It always defaults to the script/location name. I
thought that all I needed was Content-Disposition but that doesn't seem to be
working.
CentOS 5.5, mod_perl 2.0.4, apache 2.2.3 (both mod_perl and apache should be
backported via yum update).
my $zip = Archive::Zip->new();
my $member = $zip->addString('yadda yadda yadda');
my $download_name = 'download.zip';
if ( $zip->writeToFileNamed('someothernamed.zip');
open(ZIP, 'someothernamed.zip') or die "could not open sonz $!";
binmode ZIP;
my $output = do { local $/; };
close(ZIP);
$r->content_type('application/zip');
$r->header_out( 'Content-Disposition' => 'inline; filename="' .
$download_name . '"');
$r->send_http_header;
print $output;
return Apache2::Const::OK;
}
I tried setting the header before the content_type and with and without
"send_http_header". What am I doing wrong? How can I get the user to be
prompted to save the file as "download.zip??
TIA!