Hi all, I have a download section on my website but I'd like to limit the download speed to like 50KBps from the standard 10000KBps my server can handle. I've found a piece of PHP code which does 95% of what I want , but there is a thing I don't know how to fix. Here is the code: $speed = 8.5; // download rate limit if(file_exists($local_file) && is_file($local_file)) { header("Pragma: public"); // required header("Expires: 0"); header('Content-Description: File Transfer'); header("Content-Type: application/force-download"); header("Content-Length: ".filesize($local_file)); header("Content-Disposition: filename=$local_file"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename=\"".basename($local_file)."\";" ); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); readfile($local_file); flush(); $fd = fopen($local_file, "r"); while(!feof($fd)) { echo fread($fd, round($speed*1024)); flush(); sleep(1); } fclose ($fd); } Now, this works, BUT, there is no dialog box that shows and prompts user to save the file. The code works like this, when you start a download the page just hangs and shows nothing, and there is the icon on the page tab as like the website is refreshing, and file is downloading without user knowing, and when a certain amount of time passes (time needed to download file), the dialog box appears and then you can save the file where you want, no extra download required as the file already downloaded itself. What I want is, First a dialog box appears and then the file download progress is shown as normal under the limited speed. Anyone knows how I can do that? :\
I think you would have to code this in the apache configuration, and not in php: See codee.pl/cband.html