How to limit file upload speed in php or apache?

对着背影说爱祢 提交于 2019-12-09 14:57:01

问题


I'm doing some form in Zend Framework for file upload on "Apache friends - xampp" server 1.7.1 on Ubuntu 9.10.

My problem is that I what to add progress bar for this upload and since xampp server is on my localhost, file uploads are very fast. As a result, I have no time to check or observer if progress bar works as it should.

Is there an easy way (some option in PHP, Zend Framework or Apache) to reduce the file upload speed to e.g. 20kB/s.

I tried to use mod_bw for Apache but it seems that it limits only downloads from the server, not the uploads to the server. I also tried to upload large files, like 400MB, but it is not good, since my web browser nearly crashes.


回答1:


You should take a look at the answers to these questions :

  • Firefox plugin to simulate slow internet connection or limit bandwidth?
  • Network tools that simulate slow network connection
  • Tool for degrading my network connection? -- well, that one is for windows, so probably not that interesting for you

Those will not be only for PHP/Apache, but might help anyway...




回答2:


You can use the Apache-Module mod_bw: http://bwmod.sourceforge.net/

Another alternative would be mod_cband: http://codee.pl/cband.html

Although they usually refer to download-speed, the limitations should have effect for uploads as well.

Edit: just tested bwmod and limitation is only for download...



来源:https://stackoverflow.com/questions/2306112/how-to-limit-file-upload-speed-in-php-or-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!