uploadify queueData错误

我正在使用Uploadify 3.1,并且出现错误“Uncaught TypeError:单击上传按钮时无法读取未定义的属性'queueData'。 以下是我的代码。 不确定是什么问题。

上传字段:

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

使用Javascript:

$(document).on("click",".batchImportElements",function(){
        $("#objectDetails").hide().html("");
        $("#objectList").show();
        $("#objectList").html("<img src="images/loading.gif"/> Loading").show();
        $.ajax({
            type:"POST",
            data:{
                multiple:1
            },
            url:"/index.php/elements_handler/importElements",
            success:function(response){
                checkResponse(response);
                $("#objectList").html(response);

                $("#file_upload").uploadify({
                    "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);
                    },
                    "onUploadSuccess":function(file, data, response){
                        $.ajax({
                            type:"POST",
                            data:{
                                multiple:1,
                                companies_id:companies_id,
                                file:file,
                                data:data,
                                folderPath:1
                            },
                            url:"/index.php/elements_handler/importElements",
                            success:function(response){
                                checkResponse(response);
                            }
                        });
                    }
                });

                $(document).on("click",".batchImport",function(){
                    $(".batchImport").uploadify("upload");
                });
            }
        });
    });

`

$('.batchImport')是用于触发上传的按钮。 任何帮助,将不胜感激。


为什么要在文件控件上使用id file_upload创建uploadify,然后使用类batchImport调用按钮控件上的上传 ? 带有类batchImport的按钮没有被设置为一个uploadify控件,所以它应该会抛出一个错误。

// Your code
$("#file_upload").uploadify({
    ....                    
});

$(".batchImport").uploadify("upload");


// Should most likely be
$("#file_upload").uploadify({
    ....                    
});

$("#file_upload").uploadify("upload");
链接地址: http://www.djcxy.com/p/46475.html

上一篇: uploadify queueData error

下一篇: Uploadify error #2038