donglian3055 2017-11-28 15:21
浏览 227

Dropzone.js - 回调队列/上传下一个文件

I am using dropzone to upload multiple files to my upload script, which saves them and adds them and adds them to my DB. There is a problem, in that files sometimes upload so fast that the backend script gets confused and sometimes processes the same file twice. My proposed solution is to upload a file, wait for a callback from the PHP script, then upload the next one.

This should be possible with Dropzones options, but I can't get it to work.

var dropZoneOptions = {
  paramName: "file", 
  maxFilesize: 100, // MB
  addRemoveLinks: true,
  dictRemoveFile: 'Go away',
  createImageThumbnails: true,
  addRemoveLinks : true,
  uploadMultiple: false,
  parallelUploads: 1,
  autoProcessQueue: false,
  addedFile: function() {
     this.on("addedfile", function(file) {
       processFile(file);
       alert("Added file.");
     });
  },
  success:function(file,response){
     this.on("success", function(file) {
       enqueueFile(file);
       console.log(file);
     })
   }
};

The idea is for the above code to pause (autoProcessQueue: false) to wait for a response then use the enqueue file command to continue the next one (parallelUploads: 1). But my code above doesn't run the queue.

The docs for the enqueue function are here: http://www.dropzonejs.com/#enqueuing-file-uploads

Any Dropzone experts out there who can help me? Thanks in advance.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端