Using Dropzone.js to upload after new user creation, send headers

前端 未结 2 1820
闹比i
闹比i 2021-02-14 07:47

I\'m using a great plugin - dropzone.js (dropzonejs.com) to make my site a little more fancy when registering a new user.

Basically, the user fills out a form, drops a c

2条回答
  •  心在旅途
    2021-02-14 08:16

    If you use the latest Dropzone version, the parameter enqueueForUpload has been removed, in favour of autoProcessQueue which makes the whole queuing easier.

    So, just call myDropzone.processQueue() as soon as you want all files to be uploaded.

    To add additional parameters to the XHR you can simply register to the sending event, which gets the xhr object as second and formData as third parameter, and add the data yourself. Something like this:

    myDropzone.on("sending", function(file, xhr, formData) {
      // add headers with xhr.setRequestHeader() or
      // form data with formData.append(name, value);
    });
    

提交回复
热议问题