TinyPortal

Development => Feedback => Topic started by: brianjw on August 14, 2008, 07:53:42 PM

Title: [REQUEST] Limit Download Speed/Rate in Download Section
Post 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($fileround($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
Title: Re: [REQUEST] Limit Download Speed/Rate in Download Section
Post by: bloc on August 16, 2008, 11:09:05 AM
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.
Title: Re: [REQUEST] Limit Download Speed/Rate in Download Section
Post by: brianjw on August 16, 2008, 02:26:41 PM
Well, is there a feature in TP that limits downloads per day?
Title: Re: [REQUEST] Limit Download Speed/Rate in Download Section
Post by: Smoky on August 16, 2008, 02:40:00 PM
not that i have seen Brian ;)
Title: Re: [REQUEST] Limit Download Speed/Rate in Download Section
Post by: G6Cad on August 16, 2008, 02:50:08 PM
No there is not a feature in Tp V1,
Title: Re: [REQUEST] Limit Download Speed/Rate in Download Section
Post by: brianjw on August 16, 2008, 02:59:51 PM
Well then this will be my request lol for a feature in the future versions of TP. 8)