This article mainly introduces the ajax_upload Upload progress bar code implemented by PHP + apc + ajax, and analyzes in detail the installation, setting, and ajax call of the apc module to implement the upload progress bar function, you can refer to the following example to describe the ajax_upload Upload progress bar code implemented by PHP + apc + ajax. We will share this with you for your reference. The details are as follows:
How is the upload progress bar implemented? What is the principle? When we browse and select upload, a temporary file will be generated. during the upload, the temporary file will be uploaded to the server. after the upload is complete, the temporary file will be deleted. If we can read the size of this temporary file, we will know the upload progress. The php apc module can implement this function.
1. install the apc module
: Http://pecl.php.net/package/apc
tar zxvf APC-3.1.8.tgzcd APC-3.1.8//usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-configmake && make install
2. modify php. ini
extension = apc.soapc.rfc1867 = 1apc.max_file_size = 200Mupload_max_filesize = 1000Mpost_max_size = 1000Mmax_execution_time = 600max_input_time = 600memory_limit = 128M
After modification, restart apache or other services.
[root@BlackGhost php]# php -m[PHP Modules]apccgi-fcgictypecurldatedomeAccelerator。。。。。。。。
3. upload_test.php
<? Php $ id = uniqid (rand (), true);?>