PHP implements real-time upload progress bar function with APC, APC progress bar
PHP does not have a real-time upload progress bar function, if you want to have this feature we will generally use Ajax to implement, but PHP provides an APC, it can be configured with PHP to implement the upload progress bar function.
The main target is the application on the window.
1. The server to support APC extension, without this extension, download a scale extension requires more than php.5.2.
2. Configure the APC configuration to restart Apache
The code is as follows
Extension=php_apc.dll
apc.rfc1867 = On
Apc.max_file_size = 1000M
Upload_max_filesize = 1000M
Post_max_size = 1000M
Note: As for the parameters to match how big, depends on the project needs apc.max_file_size, set the size of the upload file supported by APC, requires apc.max_file_size<=upload_max_filesize and apc.max_file_size <=post_max_size. Rebooting Apache will enable APC support.
3. Use Phpinfo () in the code to see if the APC extension is installed.
4. The following is the implementation code:
getprogress.php
The code is as follows
<?php session_start (); if (Isset ($_get[' Progress_key ')) { $status = apc_fetch (' upload_ '. $_get[' Progress_key ']); Echo ($status [' Current ']/$status [' Total ']) *100; }?> upload.phpphp code<?php $id = $_get[' id ');?>
target.php
The code is as follows
<?php Set_time_limit (+), if ($_server[' Request_method ']== ' POST ') { move_uploaded_file ($_files["Test_ File "[" Tmp_name "], dirname ($_server[' script_filename '])." /uploadtemp/". $_files["Test_file" ["name"]);//uploadtemp folder is located in the same directory as this script echo "Upload successful
index.php
The code is as follows
<?php $id = MD5 (Uniqid (rand (), true));?> Upload Progress
The above is to share with you PHP using APC to achieve real-time upload progress bar function, I hope that everyone's learning is helpful.
http://www.bkjia.com/PHPjc/1065151.html www.bkjia.com true http://www.bkjia.com/PHPjc/1065151.html techarticle PHP uses APC to implement the real-time upload progress bar function, APC progress bar PHP does not have real-time upload progress bar function, if you want to have this feature we will generally use Ajax to achieve, but PHP provides ...