1. Use of PHP founder Rasmus Lerdorf wrote the APC extension module to implement ( http://pecl.php.net/package/apc )
APC implementation:
Install APC, refer to the official documentation installed, you can use the PECL module installation method is rapid simple, no description here
Configure php.ini, set the parameters apc.rfc1867 = 1, to support the upload progress bar APC function, APC source code documentation there are instructions
Code Example:
Large files (50G) uploaded implementation details:
File server data processing logic receives the code:
2. Use PECL extension module uploadprogress implement ( http://pecl.php.net/package/uploadprogress )
uploadprogress module Method:
PECL module installation method used to install the module
php.ini which set uploadprogress.file.filename_template = "/tmp/upd_%s.txt"
Code Example:
The progress of the processing logic is simple, just update the data in the database on the line. It does not require additional treatment.
Client code as follows:
The server code is as follows:
Achieve effect after:
Powerful folders to upload, can easily support 10W-level folder upload.
Speed is also good
Resume file support, support refresh your browser, close the browser, then restart the computer is still able to resume.
You can refer to this article: http://blog.ncmem.com/wordpress/2019/08/12/php-%e5%a4%a7%e6%96%87%e4%bb%b6%e4%b8%8a % e4% bc% a0% e7 % 9a% 84% e5% ae% 9e% e7% 8e% b0 /
理论上可以上传无限大的文件实时显示上传状态、进度支持多文件上传以及与表单混合上传方便的用户调用接口上传进度提供两种显示模式:新窗口或者内嵌式(0.3)多语言支持(0.21)兼容各种浏览器(经过测试的浏览器:IE5.0、IE6.0、Mozilla、Firefox、Opera)支持Mac、Linux。