本文实例为大家分享了js带进度条上传多视频的具体代码,供大家参考,具体内容如下
效果:

引用:
html:
script:
//上传视频
$(".avatarVideo").change(function() {
var _this = $(this);
_this.wrap("");
_this.parents('.fileUploadeVideo').ajaxSubmit({
dataType: 'json',
beforeSend: function () {
$(".progress").show();
},
uploadProgress: function (event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
_this.parents('.videoUpfile').find(".progress-bar").width(percentComplete + '%');
_this.parents('.videoUpfile').find(".progress-bar").html(percentVal);
_this.parents('.videoUpfile').find(".sr-only").html(percentComplete + '%');
},
success: function (data) {
if(data.code==100) {
_this.parents('.videoUpfile').find(".files").html("文件名: " + data.video_title);
_this.parents('.videoUpfile').find("input[type=hidden]").val(data.video_id);
alert("上传成功!");
}else{
alert("上传失败");
}
},
error: function () {
alert("上传失败");
}
});










