0
votes

In my current setup I'm uploading a file via a form on "form.php". This form's action calls to a new php file, "upload.php" ,that handles the upload and writes it to the server.

On my form.php I want the user to receive some sort of feedback that the file is being uploaded. This doesn't necessarily have to be a progress bar, a simple percentage from 0-100 will do the trick.

But for some reason all the examples I'm finding via google involve the use of iFrames and I can't get them to work. Is there a method for only retrieving the percentage uploaded, without the use of iFrames?

So to be clear: I do want to use jquery/apc/php/ajax etc, whichever require the job to be done. I don't want to use iFrames/Flash/HTML5 only/Plugins

1
Most examples I've seen use ajax.GordonM
Most I've seen use jquery, ajax, and iframes. Maybe I should have mentiond those as well in the post. The fact is I don't want to use iframes.user25312
Type in "upload progress ajax" into the search box. If you want to upload files in older browsers (IE9 and older), you will NEED to use iframes if you don't want to use Flash or Java.Ray Nicholus
I don't quite understand why I NEED iFrames, why isn't it possible to just have a div called progressbar allready on the page, parse the percentage complete via apc on a page that is called via ajax, and use jquery to dynamically fill the div progressbar. I don't understand why this setup is not possible, thought I do think you are correct since I can't find any without iFrames.user25312

1 Answers

0
votes

i have a demo http://www.longant.com/processbar.php and you can try! http://www.longant.com/htmls/342.html

 <script src="./jquery.js"></script>
 <script type="text/javascript">
    $(document).ready(function(){
    total = 100;
    intervalId = setInterval(function(){
     $.get("/queryTheUploadProcess.php",
        function(data){
            $(".bar").width(Math.round(data/total*100)+"%");
            if (total<data){
                clearInterval(intervalId);
            }
        });
 }, 200);
});
</script>

and in queryTheUploadProcess , you can do something what you like !