Re: Routing downloads through PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



J_K9 wrote:
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,
    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

What is before line 6?
Because the <?php should be at line 1

could you post the code from line 1 to line 10?

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux