<?php
$myfilename=$_GET['filename'];
$filepath = $_SERVER['DOCUMENT_ROOT']."/uploads/".$myfilename;
if (file_exists($filepath)) {
//download application
header("Content-Type: application/force-download");
//the filename will be given below
header("Content-Disposition:filename=\"$myfilename\"");
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($myfilename));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
//open file in binary mode
$my_file = fopen($filepath, 'rb');
//output data
fpassthru($my_file);
//close file
fclose($my_file);
}
?>