Hi,
I’m using php 5.3 and Apache 2.2 in Linux OS. The file download is not working. I have used below code. Please help! The same code was working in local pc while developed. The local pc was php 5.3, apach2.2 and windows 7.
header('Content-Description: File Transfer');
//Below line is replace by force-download because this was not working when downloaded from web server
//header('Content-Type: application/octet-stream');
header("Content-Type: application/force-download");
//header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Disposition: attachment; filename='.$actualfilename); //fetched filename from database
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));
ob_clean();
flush();
readfile($file);