2

我正在使用 plupload 队列小部件,但它不起作用。

每次我尝试上传大于 5 mb 的文件时,它都会达到 100% 并给我一个 http 错误。

当我从 3 mb 上传文件时,这将完美运行,并且在 100% 之后他给了我一个绿色的 ok 标志。

  $(function () {
        $("#uploader").pluploadQueue({
            runtimes: 'html5,html4,flash,gears,silverlight,browserplus',
            url: '/Upload/Upload',
            max_file_size: '10mb',
            post_max_size: '10mb',
            upload_max_filesize: '10mb',
            chunk_size: '10mb',
            unique_names: true,
            urlstream_upload:true,
            multipart: true,
            multiple_queues: false,
            filters: [
                   {title: "Foto's", extensions: "jpg,gif,png"},
                   {title: "Video's", extensions: "wmv,avi" },
                   { title: "Microsoft Office", extensions: "docx,xslx" },
                   { title: "Zip files", extensions: "zip" },
            ],

            preinit: {
                FileUploaded: function (up, file, response) {
                    var data = response.response; //$.parseJSON(response.response);

                    $('<input>').attr({
                        type: 'hidden',
                        name: 'fileId' + data,
                        value: data
                    }).appendTo('#uploadFinishedForm');

                    if (data.error == 1) {
                        uploader.trigger("Error", { message: "'" + data.message + "'", file: file });
                        console.log('[Error] ' + file.id + ' : ' + data.message);
                        return false;
                    }
                },

                UploadComplete: function (up, files) {
                    window.setTimeout(function (form) {
                 //       $('#uploadFinishedForm').submit();
                        $('.nextButton').append('<input type="submit" class="btn btn-large btn-success submit-btn" value="Transfer" />');
                    }, 2000)

                },

                Init: function (up, info) {
                    $('#uploader_container').removeAttr("title");
                }
            }
        });


        $('#uploadForm').submit(function (e) {
            var uploader = $('#uploader').pluploadQueue();
            if (uploader.files.length > 0) {
                uploader.bind('StateChanged', function () {
                    if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                        $('#uploadForm').submit();
                    }
                });

                uploader.start();

            } else {
                $('#uploadInfo').html('Zonder foto\'s valt er niets te uploaden!');
            }

            return false;

        });
4

1 回答 1

2

尝试减小 chunk_size 的值(例如 1mb 而不是 10mb):

chunk_size: '1mb'
于 2013-05-29T13:31:12.300 回答