I am trying to make a 'simple" php+ajax script to show progress of multiple uploaded files. I have found on this website and on other pages, packages ready to use, etc.... I want to start from scratch for several reasons, and one of them is learning. Here is how I wanted to approach it: First, I start with a ajax code in upload.php (this file contains the upload form and a to display upload progress)
<script>
$(document).ready(function(){
$("#uploadform").change(function(e)
{
e.preventDefault();
setInterval(function(){
$('div#upload_progress').load('upload_progress.php');
}, 1000);
});
});
</script>
upload_progress.php contains the code to get the instant file size on the server (I have not got there yet). So, as for now, the only line I have in 'upload_progress.php' is: 'VOILA'. Here is my problem: the div #upload_progress does not load during the file uploaded, so I don't see the text in upload_progress开发者_JAVA百科.php. I have tried to upload large files or reduce the setInterval time, but without success. Except that when I put an alert window (alert('alertme');) after the setInterval, the div#upload_progress magically get loaded. I'd really appreciate some help.
Try html5
<progress value="1" max="100">Loading</progress>
And increase value
U can use 2 divs like JMarc says..It's a little rusty and not very religious but it does the job.U retained the width in a session variable that holds the amount of file uploaded.
精彩评论