2

我使用 malsup jQuery 表单进行上传。它适用于 PHP。http://malsup.com/jquery/form/

有没有一种使用malsup添加分块上传的好方法?有什么建议么?

var xhr = new XMLHttpRequest();

    var percent = $('.percent');
    var bar = $('.bar');

    /* submit form with ajax request */
    $('form').ajaxForm({

        dataType: 'json',


        beforeSend: function() {
            bar.width('0%');
            percent.html('0%');
        },

        uploadProgress: function(event, position, total, percentComplete) {
            var pVel = percentComplete + '%';
            bar.width(pVel);
            percent.html(pVel);
        },


        success: function(xhr) {
            var percentVal = '100%';
            bar.width(percentVal)
            percent.html(percentVal);
        },

        complete: function(xhr) {
            var url = window.location.origin = window.location.protocol+"//"+window.location.host+"/thank-you/";
            window.location.replace(url);
        }



    });

编辑:有没有其他人经历过上传栏指示器在移动 Chrome 上不起作用(至少它在 iOS 版 Chrome 上不起作用,我也用他们的默认示例进行了测试)?

亲切的问候约翰

4

0 回答 0