Re: Routing downloads through PHP

From: Date: Wed, 15 Feb 2006 10:34:46 +0000
Subject: Re: Routing downloads through PHP
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-230427@lists.php.net to get a copy of this message
Lines 1-10: ---- <html> <head> <title>Downloads</title> </head> <body> <?php // fix for IE catching or PHP bug issue header("Pragma: public"); header("Expires: 0"); // set expiration time ---- Should I remove the HTML?
Exactly! HTML "is" output ya know?
Well, technically that isn't text output - it's only setting a title... ;) Anyway, I moved the PHP to the top of the file (ie. before the HTML), but now I'm getting a 500 Internal error... Here's the full code I'm using: ---- <?php header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0,
    pre-check=0");
header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); $path = "zipdata/downloadme.zip"; header("Content-Disposition: attachment; filename=".$path.";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($path)); readfile($path); ?> <html> <head> <title>Downloads</title> </head> <body> </body> </html> ---- Any idea what could be going wrong? Thanks, J_K9

« previous php.general (#230427) next »