I am using jquery file upload (http://blueimp.github.io/jQuery-File-Upload/) plugin.
My Code:
$('#fileupload').fileupload({
url: 'server/index.php',
dataType: 'json',
dropZone: $('#dropzone'),
}).bind('fileuploadprogress', function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('.progress-bar').css('width', progress + '%');
});
When I do the file upload, the progress bar is very inaccurate. Every time when I upload no matter what size the file is, the progress bar will always stuck at around 10% until the file is upload finish, then it will directly goes up to 100%.
Why is it behave like that? How can I fix it to properly display the progress?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…