Dropzone JS通过JS函数添加缩略图 - TypeError:this.defaultOptions未定义

时间:2015-04-17 04:18:19

标签: javascript jquery dropzone.js

function addthumdropzone(){
    var myDropzone = Dropzone("#myDropzone");
    var myFile = {
    name: "mypdf.pdf",
    size: 987654321
};
myDropzone.emit("addedfile", myFile);
myDropzone.emit("thumbnail", myFile, "http://localhost/simas/data/uploads/26");
};

我的代码出了什么问题?为什么我的firefox显示错误

TypeError: this.defaultOptions is undefined

我的初学者,我在document.ready

时打电话
function dropzoneinit(){
    if(typeof Dropzone != 'undefined')
        {
            Dropzone.autoDiscover = false;
            var myDropzone = new Dropzone("#myDropzone", {
            url: "engine/action/action.php",
            maxFileSize: 50,
            acceptedFiles: ".pdf",
            addRemoveLinks: true
        });
            myDropzone.on("removedfile", function(file) {
            iddata=document.getElementById("fkirimemailiddata").value;
            $.ajax({
            url: "engine/action/action.php",
            type: "POST",
            data: { 'what': 'deleteattacment','fkirimemailiddata' :iddata,'fkirimemailnmfile' :file.name}
            });
        });
    }
};

1 个答案:

答案 0 :(得分:0)

确保页面中包含dropzone.js。 看来你错过了新的'关键词。试试这个:

 var myDropzone = new Dropzone("#myDropzone");