Re: Routing downloads through PHP

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

 




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

--
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