I have a simple jquery progress bar representing file upload and I was hoping for some help to reset it after each upload.
I have tried the following which in my mind should work...however not,
$('#fileupload').fileupload({
dataType: 'json',
url: 'Home/UploadFiles',
autoUpload: true,
done: function (e, data) {
$('.file_name').html(data.result.name);
$('.file_type').html(data.result.type);
$('.file_size').html(data.result.size);
alert("File was uploaded");
$('.file_name').html("");
$('.file_type').html("");
$('.file_size').html("");
//this is where I am attempting to reset the bar after 1.5 secs
setTimeout(function () {
$('#progress .progress-bar').css('width', 0);
}, 1500);
}
}).on('fileuploadprogressall', function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('.progress .progress-bar').css('width', progress + '%');
});
You are doing it wrong to change the position
of the progress bar you need to change the value
:
$( ".progress" ).progressbar({ value: 25 });