plugin plupload不能在单个选择中上传多个文件

时间:2014-09-12 11:06:29

标签: javascript jquery jquery-plugins

下面是我的Js Code.Multiple文件选择工作正常如果我在init方法中调用FilesAdded事件。但是当我尝试将FilesAdded事件绑定到plupload对象时,即上传者只有第一个图像文件被上传到服务器休息时被丢弃。

 <script type="text/javascript">
    // Custom example logic

    var uploader = new plupload.Uploader({
        runtimes: 'html5,flash,silverlight,html4',
        browse_button: 'pickfiles', // you can pass in id...
        container: document.getElementById('container'), // ... or DOM Element itself
        url: 'Home/Upload',
        flash_swf_url: 'Scripts/Moxie.swf',
        silverlight_xap_url: 'Scripts/Moxie.xap',

        filters: {
            max_file_size: '10mb',
            mime_types: [
                { title: "Image files", extensions: "jpg,gif,png" },
                { title: "Zip files", extensions: "zip" }
            ]
        },

        init: {
            PostInit: function () {
                document.getElementById('filelist').innerHTML = '';
            },

            UploadProgress: function (up, file) {
                document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
            },

            Error: function (up, err) {
                document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
            }
        }
    });

    uploader.init();
    uploader.bind('FilesAdded', function () {
        uploader.start();
    });

</script>

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

在'FilesAdded'事件

之后输入以下代码
uploader.bind('Error', function (up, err) {
    console.log(err);
});

检查控制台中的错误代码,以便您可以进行相应的调试。