Limiter le débit d’un fichier en upload
Publié le 26 juillet 2015 | Par adminblog | Commenter
![Share on Facebook facebook](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png)
![Share on Twitter twitter](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png)
![Share on Google+ google_plus](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/google_plus.png)
![Share on Reddit reddit](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/reddit.png)
![Pin it with Pinterest pinterest](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/pinterest.png)
![Share on Linkedin linkedin](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png)
![Share by email mail](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/mail.png)
Utilitaire pour limiter la bande passante …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php // filename that the user gets for downloading $download_file = 'file-to-download.zip'; // set the download rate limit $download_rate = 20.5; //=> 20,5 kb/s header('Cache-control: private'); header('Content-Type: application/octet-stream'); header('Content-Length: '.filesize($download_file)); header('Content-Disposition: filename='.$download_file); flush(); // open file stream $file = fopen($download_file, "r"); while(!feof($file)) { // send the current file part to the browser print fread($file, round($download_rate * 1024)); // flush the content to the browser flush(); sleep(1); } fclose($file);} ?> |
This Post Has Been Viewed 61 Times
![Share on Facebook facebook](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png)
![Share on Twitter twitter](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png)
![Share on Google+ google_plus](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/google_plus.png)
![Share on Reddit reddit](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/reddit.png)
![Pin it with Pinterest pinterest](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/pinterest.png)
![Share on Linkedin linkedin](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png)
![Share by email mail](http://info57.fr/wp/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/mail.png)
Commentaires récents