עשיתי copy & paste:
PHP קוד:
<?php
$local_file = "sol-nv-b99-x86-dvd-iso-a.zip";
$download_file = "test.bin";
$download_rate = "10";
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
// use the Content-Disposition header to supply a recommended filename and
// force the browser to display the save dialog.
header("Content-Disposition: attachment; filename=".basename($download_file).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($local_file));
// open file stream
$file = fopen($local_file, "r");
while(!feof($file)) {
// send the current file part to the browser
print fread($file, round($download_rate * 1024));
// flush the content to the browser
flush();
// sleep one second
sleep(1);
}
?>
גרסת PHP:
קוד:
PHP 5.2.6 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Sep 6 2008 02:21:32)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies