Can anyone help me figure out why when I download a zip file with headers in php it is invalid? The file opens fine on my server but when I test my download code and save the file to my desktop it says it is invalid. What could be causing this? Here is the code I am using to download the zip file:
PHP Code:
if (file_exists ($file)) {     
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Description: File Transfer');
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=' .basename($file));
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($file));
// Stop the page.

Any Suggestions?