Pause with download [RESOLVED]
Posted: Fri Jan 06, 2006 3:21 pm
With the help of a few posts around here I figured out how to send a download to a user. The problem is there is a delay of around 30 seconds between when someone clicks and when the download start. 
Its not the server because the download starts right away if I send the file link via header. So I am not sure what the problem is.
Any help would be great, thanks.
Its not the server because the download starts right away if I send the file link via header. So I am not sure what the problem is.
Any help would be great, thanks.
Code: Select all
if (!function_exists('mime_content_type')) {
function mime_content_type($f) {
$f = escapeshellarg($f);
return trim( `file -bi $f` );
}
}
$file = $folder . '/' . $file_name;
$size = filesize($file);
$content = mime_content_type($file);
$name = basename($file);
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private");
header("Content-length: $size");
header("Content-type: $content");
header("Content-Disposition: attachment; filename=$name");
readfile($file);