/ Published in: PHP
This snippet allows you set a limitation for download rate of the file that visitors download from your site.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* set here a limit of downloading rate (e.g. 10.20 Kb/s) */ $download_rate = 10.20; $download_file = 'download-file.zip'; $target_file = 'target-file.zip'; /* headers */ /* flush content */ /* open file */ /* send only current part of the file to browser */ /* flush the content to the browser */ /* sleep for 1 sec */ } /* close file */ }else{ } ?>
URL: http://www.apphp.com/index.php?snippet=php-download-file-with-speed-limit