Page 1 of 1
Download speedlimit for Guest User
Posted:
Sat Nov 10, 2012 9:31 pm
by baipai
how make a modification for "download speed limit" in version 2.1.xx ?
i see a solution but is for version 1.xx
must only modify download2.php????????
Re: Download speedlimit for Guest User
Posted:
Wed Nov 14, 2012 4:05 pm
by SamEA
Find in ./download2.php:
- Code: Select all
header('Content-type: application/octetstream');
header('Content-Length: ' . filesize("./storage/".$validdownload[0]));
header('Content-Disposition: attachment; filename="'.$validdownload[1].'"');
readfile("./storage/".$validdownload[0]);
die();
Replace with:
- Code: Select all
$speed_rate = 100;
//Speed is in KB/s (Kilobytes per second).
header('Cache-control: private');
header('Content-type: application/octetstream');
header('Content-Length: ' . filesize("./storage/".$validdownload[0]));
header('Content-Disposition: filename='.$validdownload[1]);
flush();
$dfile = fopen("./storage/".$validdownload[0], "r");
while (!feof($dfile)){
print fread($dfile, round($speed_rate * 1024));
flush();
sleep(1);
}
fclose($dfile);
Re: Download speedlimit for Guest User
Posted:
Wed Nov 14, 2012 4:07 pm
by SamEA
If you have multiple servers on DFH, you will have to apply the above to the addition server's ./multiserver/download.php file.
Let me know if you encounter any issues.
Re: Download speedlimit for Guest User
Posted:
Fri Nov 16, 2012 8:51 pm
by baipai
thanks SamEA
I had already found.
the following problem.
if a download is running, it blocked the whole server.
I think there are major performance problem if 10 downloads simultaneously
do not have another solution?
Re: Download speedlimit for Guest User
Posted:
Sun Nov 18, 2012 5:57 am
by SamEA
Yes, as mentioned in the previous post, I'm afraid this modification may use more of the computer's resources than normal.
I do not believe there is another solution, unless it involves modifying the apache's config files. However, you may search on Google for further solutions on how to modify download speeds with PHP, and if you find anything, I'll happily look into it.
Thank you.
Re: Download speedlimit for Guest User
Posted:
Sun Nov 18, 2012 10:12 am
by baipai
Thanks,
I'll look further and report if I find a solution
depositfiles and rapidshare can do, then we can do too.
I am confident.... This is a Great Script