2014-04-29 35 views
0

我需要知道如何之前添加文件預覽訪問的事件(不addedfile事件,因爲它添加文件後實際調用,因此不接受事件) 我需要的是這樣的dropzone.js BEFORE文件添加事件

myDropzone.on("beforeaddedfile", function(file) { 
     if(/*some condition*/) 
    //add file 
    else 
    // don't add file 


    }); 

回答

0

我想你應該可以做幾乎同樣的事情「addedfile」事件,就像這樣:

myDropzone.on("addedfile", function(file) { 
    if(/*some condition*/) { 
    //continue to do something and add file 
    } else { 
    // don't add file 
    myDropzone.removeFile(file); 
    } 
}); 

我希望這對你的作品:)