TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 330
  • Total: 330

[REQUEST] Limit Download Speed/Rate in Download Section

Started by brianjw, August 14, 2008, 07:53:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brianjw

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

bloc

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.

brianjw

Well, is there a feature in TP that limits downloads per day?


G6Cad


brianjw

Well then this will be my request lol for a feature in the future versions of TP. 8)

This website is proudly hosted on Crocweb Cloud Website Hosting.