У меня есть этот код здесь, однако я хочу ограничить скорость, с которой пользователь может загружать, как бы я внедрил это в этот код;
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize("uploads/$filename"));
header("Content-disposition: attachment; filename=\"$origname");
readfile("uploads/$filename");
Спасибо!
Это то, что я пробовал;
$download_rate = 100;
$ origname = get_file_name ($ file [0]);
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize("uploads/$filename"));
header("Content-disposition: attachment; filename=\'$origname'");
$local_file = "uploads/$origname";
// flush content flush ();
// 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);
}
// close file stream
fclose($file);
Почему это не работает?