Re: Routing downloads through PHP
| From: | Stut | Date: | Wed, 15 Feb 2006 10:49:09 +0000 |
| Subject: | Re: Routing downloads through PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230429@lists.php.net to get a copy of this message | ||
J_K9 wrote:
Well, technically that isn't text output - it's only setting a title... ;)'Technically' anything that gets sent to the browser is output. Why are you trying to set a title when you are sending a binary file? An HTML title is only relevant if you're returning HTML to the client.
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,I'm no expert but the first thing I'd try is only sending one Content-Type header. Which is it? However, I doubt that would cause an internal error, but then I can't see anything in this code that would. Hope that helps. -Stutpre-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>