[nycphp-talk] Force download

Peter Sawczynec ps at
Tue Sep 12 14:48:30 EDT 2006

Try to box it in a bit more. 
For example, will other file types download successfully. 
[Typically, .zip files will always download properly.] 
Try appropriately filled out inclusion of additional headers as suggested in
below sample:
$filename = "MAQ09718.MP4";
header("Pragma: public"); 
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); 
header("Content-Type: application/force-download");
header("Content-Disposition: attachment;
filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
Google "force file download issues php" to find more headers you may need.
Call directly to and/or surf manufacturer's site for known issues / browser
version issues. 
Warmest regards,
Peter Sawczynec,
Technology Director
_Design & Interface
_Database Management
ps at

-----Original Message-----
From: talk-bounces at [mailto:talk-bounces at] On
Behalf Of Nathan Lavertue
Sent: Tuesday, September 12, 2006 2:29 PM
To: NYPHP Talk
Subject: [nycphp-talk] Force download

Any reason why the following script wouldn't force download the file in
question with the appropiate name in all situations? Works in a few
browsers, but, not while using the Internet Browser on the PSP. Tries to
save the file 'download.php' instead of the actual video file. 


header("Pragma: no-cache");
header("Expires: 0");
header('Content-Description: File Transfer');
header('Content-type: application/force-download');
$filename = "MAQ09718.MP4";

header("Content-Disposition: attachment;
filename=\"".basename($filename)."\";" );
header("Content-Length: " . filesize($filename));



Nathan Lavertue
Lead Designer & Developer - New Formats
Sony Music Studios - X Media Group

On Sep 11, 2006, at 11:53 AM, Aaron Deutsch wrote:

Has anyone used the pear LiveUser auth classes?  Are they worth the hassle
of setting up and trying (also still in beta) or is there a better/easier
user login management tool available.
aaron d.
New York PHP Community Talk Mailing List

NYPHPCon 2006 Presentations Online

Show Your Participation in New York PHP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the talk mailing list