Scripts
Download speed limit met php
De file moet zicht wel op de zelfde server bevinden als de script. Bron: http://nl2.php.net/fread/
download-speed-limit-met-php
[code]
<?php
$file = "test.mp3";
$speed = 500.0;
if(file_exists($file) && is_file($file)) {
header("Cache-control: private");
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($file));
header("Content-Disposition: filename=$file");
flush();
$fd = fopen($file, "r");
while(!feof($fd)) {
echo fread($fd, round($speed*1024));
flush();
sleep(1);
}
fclose ($fd);
}
?>
[/code]
Reacties
0