Hi I'm currently working on some php - zend framework project on my osx - apache. The problem is when ever I want to force the download of some files using my php application the downloaded files is corrupted and the size of the file is 5.4 kb! I've tried so many changes in my code and even used some classes to force the download but still the problem is the same! I should say I used the force download in one my controllers' actions. Does the rewrite or something likes this has affect over the downloading of the file ?!
This is the base code :
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file["files_url"]));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file["files_url"]));
ob_clean();
flush();
readfile($file["files_url"]);
exit;*/
And the Classes I used : BF_Download
$download = new Download($file["files_url"],$file["files_title"],"on",20);
$download->download_file();
And :
$zip = new zip_file("../".$file["files_title"].".zip");
$zip->set_options(array('inmemory' => 1, 'recurse' => 0, 'storepaths' => 0));
$zip->add_files($file["files_url"]);
$zip->create_archive();
$zip->download_file();*/