// send headers
header("Content-type: $mimetype");
header("Content-length: $filesize");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$filesize);
header("Content-disposition: attachment; filename=\"" . urlencode(basename($file)) ."\"" );
$handle = fopen($file, "rb");
if(!$handle) errpic("Unable to open file");
while(!feof($handle)){
echo fread($handle, 16384);
flush();
}
|