perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John N. Brahy" <jbr...@ad2.com>
Subject RE: Content Disposition header and file contents sequence...
Date Thu, 02 Mar 2006 19:00:11 GMT
Just as I give up and email the list.... 

I figured out that the database wasn't returning the filename so it
wasn't able to open the file for download so when I hard coded a
filename it started working. The thing I don't understand is why didn't
I get a server error when it wasn't able to open a file... 



> -----Original Message-----
> From: John N. Brahy [mailto:jbrahy@ad2.com]
> Sent: Thursday, March 02, 2006 10:46 AM
> To: modperl@perl.apache.org
> Subject: Content Disposition header and file contents sequence...
> 
> This is the relevant part of my handler for a link that I want to
force
> a download for. I know it's content-disposition but for some reason I
> can not get it to actually download the file. I get the download
dialog
> and I choose the location to save it but when I open the document it
is
> empty. I've tried changing the sequence of the items but it never
works.
> 
> 
> my $filename = "/usr/local/app/media/videos/downloads/preview.mov";
> unless ($fileFH = Apache::File->new($filename)){
> 	$r->log_error("couldn't open $filename for reading: $!");
> 	return SERVER_ERROR;
> }
> $r->content_type('video/quicktime');
> $r->headers_out->set('Content-Disposition' =>
> "attachment;filename=$downloadFilename");
> $r->send_fd($fileFH);
> $r->send_http_header();
> return OK;
> 
> 
> 
> 
> 
> ::::: John Brahy
> ::::: CIO
> ::::: www.ad2.com
> 
> ::::: johnb@ad2.com
> ::::: t: 310-356-7500
> ::::: f: 310-356-7520
> 
> ::::: ad2, Inc.
> ::::: 1990 East Grand Ave, Suite 200
> ::::: El Segundo, CA 90245


Mime
View raw message