0

I use Ajax and Progress bars into Twitter bootstrap for uploading file function. But I don't know how to get percentage uploading file with Ajax. Please help, thanks.

LazyCatIT
  • 667
  • 2
  • 14
  • 37
  • 1
    Refer this http://stackoverflow.com/questions/15965651/progress-bar-while-uploading-large-files-with-xmlhttprequest . You can do it using XmlHttpRequest 2 – SeeTheC Oct 21 '14 at 04:48

1 Answers1

1

There's a jQuery file upload plugin that you can use. It allows you to call a progress function. The Git for the plug-in is here: GitHub Repo. I found this tutorial a few weeks ago on putting the plugin to use for the same reason, here's a partial example.

progress: function(e, data) {
            // Calculate the completion percentage of the upload
            var progress = parseInt(data.loaded / data.total * 100, 10);
            // Update the hidden input field and trigger a change
            // so that the jQuery knob plugin knows to update the dial
            data.context.find('input').val(progress).change();
            if(progress == 100) {
                data.context.removeClass('working');
            }
        }
dc317
  • 26
  • 1