Home  >  Article  >  Backend Development  >  Solution to the problem of using php+apc to implement the upload progress bar and not displaying it in IE7_PHP Tutorial

Solution to the problem of using php+apc to implement the upload progress bar and not displaying it in IE7_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:11:57779browse

Today I will sort out the program code that I wrote before about uploading files and displaying the progress bar, and optimize and organize the code. Solved the problem that has been bothering: sometimes the progress bar does not reach 100%, and the browser appears suspended. The test in IE8 and chrome is perfect.

Project requirements:

Upload the APK and display the upload progress bar. After the upload is completed, the APK will be analyzed, and it will display: Analyzing apk data, please wait... After the analysis is completed, it will display: Upload successful, re-upload

Since my computer is installed with the English version of winxp, the default IE is IE7. During the test, I found that the progress bar was not displayed. The percentage is not displayed either.

Troubleshooting:

1. Change the DOM to jquery mode without displaying

2. Add a delay to the recursive call and do not display it. Add the delay code: setTimeout("getProgress('"+upid+"')",500);

3. Is it caused by a container-level problem? So test whether to execute the upload period module. Just add a container to the page, write a global variable i, and write it to the container i++ in the module called during the upload. It will display and indicate the correct call

4. Now that the progress bar and percentage are both 0, is there something wrong with the json data received?

Since the code I returned is: echo json_encode($arr); itself is json data, but in order to find out the reason, I will execute the returned data once: var dataObj=eval("("+data+")" );//Convert to json object

Show script errors.

5. Is it cache? So copy the code

as follows:
$.getJSON("ProcessBar.php",{progress_key:upid}, function(result){


is changed to:


Copy code The code is as follows:
$ .getJSON("ProcessBar.php",{progress_key:upid,time:(new Date()).getTime()},function(result){


Perfectly solves the problem.

http://www.bkjia.com/PHPjc/326784.html

truehttp: //www.bkjia.com/PHPjc/326784.htmlTechArticleToday I compiled the program code that I wrote before about uploading files and displaying the progress bar, and optimized and organized the code. . Solved the problem that has been bothering me: sometimes the progress bar does not reach 100...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn