if (isset($_GET['file_id']) && is_numeric($_GET['file_id'])) { // row is database result $basename = $row['filename'] . "." . $row['fileext']; header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header("Content-type: application/force-download"); header("Content-length: {$row['filesize']}"); header("Content-disposition: $attachment; filename=$basename"); $fhandle = fopen($file, "rb"); fpassthru($fhandle); exit; } else { die("ko"); }