This code should work for you. It basically forces the file download.
Code:
$file = $data ['name'];
$path = './'. $file;
if (file_exists ($path))
{
header ('Content-disposition: attachment; filename="'. $file.'"');
header ('Content-Type: application/force-download');
header ('Content-Transfer-Encoding:binary');
header ('Content-Length:'.filesize ($path));
header ('Pragma: no-cache');
header ('Cache-Control: must-revalidate, post-check = 0, pre-check = 0');
header ('Expires:0');
readfile ($path);
}
else
{
$errorFile = 'The file'. $file. "n\ 'exist. Please excuse us for the inconvenience. ';
}
Bookmarks