2

使用 Dropzone.js,如果我尝试粘贴(ctrl+v)一个打印屏幕,它不会上传,但是如果我拖动一个文件,上传就可以了。有人能帮我吗?

   Dropzone.autoDiscover = false;


   var dropzone = new Dropzone("form.dropzone", {
       dictDefaultMessage: "Arraste uma imagem ou clique aqui"
   });


   document.onpaste = function(event){
       var items = (event.clipboardData || event.originalEvent.clipboardData).items;
       for (index in items) {
           var item = items[index];
           if (item.kind === 'file') {
               // adds the file to your dropzone instance
               dropzone.addFile(item.getAsFile());
           }
       }
   }
4

0 回答 0