Blueimp jquery fileupload不会触发"添加"打回来

时间:2017-01-25 22:51:30

标签: jquery file-upload blueimp

我已经获得了blue-imp文件上传器,可以在桌面浏览器上正常工作但是从iphone上传图像时遇到问题。特别是,在选择文件后,代码默默地失败:因为我有一个不会弹出的警报(添加了文件),所以看起来添加回调没有被触发。任何建议将不胜感激!

我的jquery:

$(function () {
        'use strict';
        $('#fileupload').fileupload({
            maxChunkSize: 10000000,
            url: 'third-party-uploader/init-third-party-uploader',
            dataType: 'json',
            maxRetries: 10,
            retryTimeout: 500,
            add: function (e, data) {
                alert('File added.');
                var that = this;
                $.getJSON(getUrl() + 'third-party-uploader/get-uploaded-bytes', {file: data.files[0].name}, function (result) {
                    data.uploadedBytes = result.size;
                    $.blueimp.fileupload.prototype.options.add.call(that, e, data);
                });

            },
            fail: function (e, data) {
                alert('Whoops!');
            },
            done: function (e, data) {
             alert('Finished');

            },
            progress: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .progress-bar').css(
                        'width',
                        progress + '%'
                        );
            }
        }).prop('disabled', !$.support.fileInput)
                .parent().addClass($.support.fileInput ? undefined : 'disabled');
    });

0 个答案:

没有答案