CodeIgniter Forums
Progress Bar when file upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Progress Bar when file upload (/showthread.php?tid=18001)



Progress Bar when file upload - El Forum - 04-22-2009

[eluser]yannyannyann[/eluser]
Hello

I have a jquery ajax upload system that works well.
However as I am uploading big files I would like to display a progress bar, or a simple percentage value, for the user to see that the upload didn't crash.

How could I implement that in my code ?

Code:
jQuery("#addVideoForm").validate({
        rules: {
            userfile: {
                  required: true,
                accept: "mov|avi|mpg|flv"
            }
        },
        submitHandler: function(form) {
            jQuery(form).ajaxSubmit({
                target:        '#positive-result',  
                beforeSubmit:  showRequest,
                success:       showResponse  
            });
        }
    function showRequest(formData, jqForm, options) {
        $('#result').fadeIn("slow");            
        $('#positive-result').html("Uploading...");
        var queryString = $.param(formData);
        return true;
    }

    function showResponse(responseText, statusText)  {    
        
        $('#positive-result').html( 'Video added.');
        $('#result').fadeIn("slow");    
    }
    });



Progress Bar when file upload - El Forum - 04-22-2009

[eluser]Colin Williams[/eluser]
You essentially need to iteratively monitor the size of the uploading file on the server file system and compare it to the total size of the file.


Progress Bar when file upload - El Forum - 04-22-2009

[eluser]TheFuzzy0ne[/eluser]
To my understanding, this takes special configuration of the server, using the apc_fetch() or uploadprogress_get_info() functions available in the PECL extension.


Progress Bar when file upload - El Forum - 04-22-2009

[eluser]yannyannyann[/eluser]
yeah i can't configure APC :-(


Progress Bar when file upload - El Forum - 04-22-2009

[eluser]pistolPete[/eluser]
You could use a flash based uploader, e.g. swfupload.org.