This article mainly introduces the use of PHP APC module production upload progress bar, interested in the friend's reference, I hope to be helpful to everyone.
APC module, its full name is alternative PHP Cache. APC can cache all of the PHP code,
There are two ways I know now, one is to use the APC extension (HTTP://PECL.PHP.NET/PACKAGE/APC) written by the founder of Php Rasmus Lerdorf, and the other is to use the PECL extension module Uploadprogress implementation
Currently, I know two methods: one is to use the APC extension module written by RasmusLerdorf, founder of PHP, and the other is to use the uploadprogress extension module of PECL.
Currently, I know two methods: one is to use the APC extension
I. Principle of component-less upload
Let me describe it with an instance at 1.1. The client HTML is as follows. To browse and upload attachments, we use the element, but be sure to set the enctype attribute of form to "multipart/form-Data ":
Today, I sorted out the program code about uploading files and displaying the progress bar, and optimized the code. Solve the problem that has been plagued: Sometimes the progress bar does not reach 100%, and the browser is suspended. The tests in
ASP tutorial. Net File Upload progress bar implementation code
index.htm is the File upload page, submit form to the Uploadhandler directory default.aspx, to achieve file upload.
Progresshandler directory three files for the ABORT.ASHX,
PHP with APC implementation upload progress bar, has always thought that PHP is unable to achieve a dynamic function of the progress bar, the original or their own knowledge is not enough, see the APC extension related to some articles, the use of
Let's take a look at the effect chart first:
Here is the code added to the as IFRAME.
Import flash.net.FileReference;Import Mx.controls.Alert;
var My_pb:mx.controls.ProgressBar;var maxSize = 1000*1000*100; File size limit: 100MSet progress bar
Nodejs the processing of file upload
In the Express4 req.files already is undefined , now use the most probably is formidable , you know it has an progress event, so Heart exultation, low version IE progress bar has a chance; OK, try it:
Ajax File Upload progress barPreface:Idea: first, the form is submitted to the servlet, And the servlet is used for file upload. The uploaded parameters are encapsulated into objects and saved to the session. The submitted pages are hidden iframe
Browse-select a file-click "Upload" and the effect is as follows:
The transparent UI mask layer is displayed and the upload process is displayed. I have set it to be too transparent and the effect is not very stereoscopic.
File structure
(The
File Upload has a variety of beautiful styles with progress bars!
Friendly prompts and upload verification!
PartCode:
Form ID = "Form1" Runat = "Server"> ASP : Scriptmanager ID
Recently, the boss to make a progress bar effect out, this has not really done before. There's nothing left this week, just take this to fill the numbers.
File upload, you have to prepare a "button":
This looks pretty good, and the
The main target is the application on window.1. The server to support APC expansion, without this extension, Baidu click Php_apc.dll, download an extension of expansion requirements php.5.2 above.2. Configure APC configuration, restart Apache
Since 5.2, APC joined a apc_upload_progress, which solves the problem of the progress bar that has plagued us for a long time. And it is the original upload when the temporary files are all cached to memory, when the temporary file reached the set
Specific code
The code is as follows
Copy Code
function Uploadprogress (file, bytesloaded) { try { var percent = Math.ceil ( Bytesloaded/file.size); var progress = new fileprogress
For the long-loaded ASP. NET page, we can display the progress bar in the client browser to show that the page is loading. Here is the specific implementation process:Create a new project with the name Webportal, select a Visual C # project in the
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.