0

我对uploadify 有一个问题,它不会自动上传队列中的所有文件。要么我没有正确地将它们添加到队列中,要么我遗漏了一些东西。当我单击上传按钮时,我真的希望将队列中的所有文件都上传,但是每次上传完成时我都必须单击上传按钮。

按钮代码:

<div id="some_file_queue"></div>
<input type="file" name="batchImport" id="batchImport"/>
<input type="button" class="batchImport" value="Upload Files">

javascript:

$("#batchImport").uploadify({
                'queueSizeLimit':10,
                'queueID':'some_file_queue',
                "swf":"/js/uploadify-v3.1/uploadify.swf",
                "uploader":"/js/uploadify-v3.1/uploadify.php",
                "uploadFolder":"/uploads/",
                "auto":false,
                "multi":true,
                "height":19,
                "width":94,
                "onUploadError":function(file,errorCode,errorMsg,errorString){
                    alert("The file " + file.name + " could not be uploaded: " + errorString);
                },
                "onQueueComplete":function(queueData){
                    console.log(queueData);
                },
                "onUploadSuccess":function(file, data, response){
                    $.ajax({
                        type:"POST",
                        data:{
                            single:1,
                            file:file,
                            data:data,
                            call:'element',
                            objContainer:$('select[name="objContainer"] option:selected').val()
                        },
                        url:"/index.php/upload_handler/handler",
                        success:function(response){
                            checkResponse(response);
                        }
                    });
                }
            });

            $(document).on("click",".batchImport",function(){
                $("#batchImport").uploadifyUpload("*");
            });
4

3 回答 3

2

如果您按照以下方式设置 auto:true: http ://www.uploadify.com/documentation/uploadify/auto/ 文件将自动上传。

于 2012-11-03T11:46:07.583 回答
1

我相信您正在寻找:

$("#batchImport").uploadify('upload','*');

uploadify 网站上的现场演示。

于 2012-07-25T17:41:02.507 回答
-1

您应该在您的javascript代码中放置“auto”:true..然后它的工作..

$("#batchImport").uploadify({ 'queueSizeLimit':10, 'queueID':'some_file_queue', "swf":"/js/uploadify-v3.1/uploadify.swf", "uploader":"/ js/uploadify-v3.1/uploadify.php", "uploadFolder":"/uploads/", "auto":true, "multi":true, "height":19, "width":94, "onUploadError":function(file,errorCode,errorMsg,errorString){ alert("文件 " + file.name + " 无法上传: " + 错误字符串); }, "onQueueComplete":function(queueData){ console.log(queueData); }, "onUploadSuccess":function(file, data, response){ $.ajax({ type:"POST", data:{ single:1, file:file, data:data, call:'element', objContainer:$('select[name="objContainer"] option:selected').val() }, url:"/index.php/upload_handler/handler", success:function(response){ checkResponse(response); } }); } });

        $(document).on("click",".batchImport",function(){
            $("#batchImport").uploadifyUpload("*");
        });
于 2013-10-09T06:37:04.500 回答