Re: Routing downloads through PHP

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

 



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


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.

-Stut

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