PHP uses APC to implement real-time upload progress bar function, APC progress bar _php Tutorial

Source: Internet
Author: User
Tags apc apc configuration

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.