1 2 3 4 5 6 7 8 9 10
// 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;