kancheng1989
kancheng1989
采纳率0%
2017-10-11 09:21

jquery.fileupload.js 上传插件进度条的问题

jquery.fileupload.js上传,为何在页面中上传完成之后才执行progressall。 是后端程序要返回进度吗?怎么弄呢
环境: mvc
代码:
$("#" + FileID).fileupload({
url: DocumentHost + UploadFile,
dataType: 'text',
type: "POST",
formData: { },
forceIframeTransport: true, //跨域支持
autoUpload: false,
done: function (e, data) {},
add: function (e, data) {},
change: function (e, data) {},
progress: function (e, data) {//设置上传进度事件的回调函数
var progress = parseInt(data.loaded / data.total * 100, 10);
$("#progress_" + FileID).css("width", parseInt(progress) + "%");
$("#complete_" + FileID).html(parseInt(progress) + "%");
},
progressall: function (e, data) {//设置上传进度事件的回调函数
var progress = parseInt(data.loaded / data.total * 100, 10);
$("#progress_" + FileID).css("width", parseInt(progress) + "%");
$("#complete_" + FileID).html(parseInt(progress) + "%");
}
});

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • Oh_my_godness Oh_my_godness 4年前
     $(function() {
            $('#fileupload').fileupload({
                url:'appVersionController.do?uploadfile',
                dataType : 'json',
                done : function(e, data) {
                    data = data.result;
                    if (data.success) {
                        var api = frameElement.api;
                        var W = api.opener;
                        $("#url").val(data.attributes.fileName);
                        $("#behind").html(data.msg);
                    } else {
                        $("#behind").html(data.msg);
                    }
                },
                progressall: function (e, data) {
                    var progress = parseInt(data.loaded / data.total * 100,10);
                    $('#progress .bar').css(
                            'width',
                            progress + '%'
                        );
    
                }
            });
        });
    
    点赞 评论 复制链接分享

相关推荐