TinyPortal
Development => Feedback => Topic started by: brianjw on August 14, 2008, 07:53:42 PM
Some websites have thousands of downloads... Some websites (like mine) want to have thousands of downloads. I have the downloads available but I want to limit the download speed so I can limit how much bandwidth is going to be used. There are several scripts on php.net that allow you to do this.
I found this one:
<?php
$local_file = 'file.zip';
$download_file = 'name.zip';
// set the download rate limit (=> 20,5 kb/s)
$download_rate = 20.5;
if(file_exists($local_file) && is_file($local_file))
{
header('Cache-control: private');
header('Content-Type: application/octet-stream');
header('Content-Length: '.filesize($local_file));
header('Content-Disposition: filename='.$download_file);
flush();
$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);
}
fclose($file);}
else {
die('Error: The file '.$local_file.' does not exist!');
}
?>
I wish that a feature like this could be integrated for the TP Download Section and in the TP Download Settings it would ask you for the download rate/speed and we could enter it in the admin panel. If we set it to 0 it could allow however much it allows now or whatever.
Let me know if this could be a possible feature! Thanks! :)
Brian
That seems like a crude way of doing it..holding back chuncks of data for small periods of time?
If anything...having limits on downloads per day/week/month etc. is a much better method. Because it doesn't matter what "speed" you set(it isn't really slowing speed as such, its pausing between full speed amd nothing) the bandwidth get used based on filesize downloaded. And by limiting downloads to 5 per day for example, you stop using it up.
The actual download speed people can use is 1) depending on their ISP line and 2) depending on limits set on server.
Well, is there a feature in TP that limits downloads per day?
not that i have seen Brian ;)
No there is not a feature in Tp V1,
Well then this will be my request lol for a feature in the future versions of TP. 8)