Re: Routing downloads through PHP
| From: | Barry | Date: | Wed, 15 Feb 2006 10:22:40 +0000 |
| Subject: | Re: Routing downloads through PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230425@lists.php.net to get a copy of this message | ||
J_K9 wrote:
Barry wrote:Exactly! HTML "is" output ya know? -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)J_K9 wrote: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?This is what I used: ---- <?php // fix for IE catching or PHP bug issue header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0,What is before line 6? Because the <?php should be at line 1 could you post the code from line 1 to line 10?pre-check=0");// browser must download file from server instead of cache // force download dialog header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); // Path to your file $path = "zipdata/downloadme.zip"; // use the Content-Disposition header to supply a // recommended filename and // force the browser to display the save dialog. header("Content-Disposition: attachment; filename=".$path.";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($path)); readfile($path); ?> ---- As you can see, there is no output before the headers are set. In fact, the error say that the headers were set on line 6, which is <?php. How can this be? Is there something I need to turn off like default headers? Thanks, J_K9