I am seeking some help with a problem that I just can't solve yet.
I have a download script where I use php to deliver a file. Here's the basic download script:
$length = filesize($source); header('Pragma: private'); header('Cache-control: private, must-revalidate'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Content-type: application/zip"); header("Content-Transfer-Encoding: Binary"); header("Accept-Ranges: bytes"); header("Content - length: $length"); header("Content-disposition: attachment; filename=filename.zip"); readfile($source);
This code works great, except that when I use the 'Content-length' header, the file downloads, and the downlaod queue shows the size of the file, but then the file doesn't open right. However, if I remove the content-length header altogether, then the file downloads just fine, and it opens fine. However, then the download queue doesn't know how large the file is!
I would like for the download queue to know how big the file is, so that the user can see how long it will take, etc. If anyone has any ideas or tips, I would love to know! Thanks.
NOTE: I had to alter the 'Content-length' line by adding spaces before and after the dash because the board wouldn't post the content. Strange.