$("#upForm").ajaxSubmit({
url:"/MultimediaTemplate/multimediaVideoFileUpload.do",
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function (res) {
$('#bj').hide();
$("#fileVideo").val("");
alert("上传成功");
},
xhr: function() {
var xhr = new XMLHttpRequest();
//使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
xhr.upload.addEventListener('progress', function (e) {
console.log(e);
//loaded代表上传了多少
//total代表总数为多少
var progressRate = (e.loaded / e.total) * 100 ;
$('#bfb').text(parseInt(progressRate)+ '%');
$('.jd2').width(parseInt(progressRate)+'%');
})
return xhr;
}
});