The code is divided into the following parts:
demo.php(as the current mainstream development language) - upload process processing
PLAIN TEXTphp(do As the current mainstream development language):
(As the current mainstream development language)
include UploadProgressMeter.class.php(As the current mainstream development language);
$fileWidget = new UploadProgressMeter();
if ($fileWidget->uploadComplete()) {
/ / When the upload is completed, send a js from the iframe to the main window to indicate that everything is ok
echo $fileWidget->finalStatus();
// Process the uploaded file...
Exit;
}
?>
demoserver.php(as the current mainstream development language) - ajax(static website)Server-side js, use Pear:HTML_ajax(dynamic website static), directly call the UploadProgressMeterStatus class
PLAIN TEXTHTML:
(as the current mainstream development language) echo $fileWidget->renderIncludeJs(); ?>
Style sheet for progress bar
PLAIN TEXTCSS:
.progressBar {
position: relative;
padding: 2px;
width: 300px;
height: 40px;
font-size: 14px;
}
.progressBar .background {
border: solid 1px black;
width: 270px;
height: 20px;
}
.progressBar .bar {
position: relative;
background-color: blue;
width: 0px;
height: 20px;
}
Form part
PLAIN TEXTHTML:
Download
The author's svn browse
Other similar projects:
http://pdoru.from.ro/ - in the form of patch and php(As the current mainstream development language)Compile together
http://www.ugia.cn/?p=54 - Upload files using socket and display progress bar