[Solved] Send one file of Dropzone to multiple urls


I don’t think there is a built in feature in dropzone to do that, but you can send an additional xmlhttprequest for each additional url, you can send this second request in any event that gets the dropzone file object.

Here a bare minimum example sending it when the default upload was successful:

js:

Dropzone.options.myDropzone = {

    // This is the default dropzone url in case is not defined in the html
    url: 'upload.php',

    init: function() {

        this.on('success', function(file){

            // Just to see default serve response on console
            console.log(file.xhr.responseText);

            // Creat a new xmlhttprequest with the second url
            secondRequest = new XMLHttpRequest();
            secondRequest.open('POST', 'upload2.php', true);

            // Just to see second server response on success
            secondRequest.onreadystatechange = function () {
                if(secondRequest.readyState === XMLHttpRequest.DONE && secondRequest.status === 200) {
                    console.log(secondRequest.responseText);
                }
            };

            // Create a new formData and append the dropzone file
            var secondRequestContent = new FormData();
            secondRequestContent.append('file', file, file.name);

            // Send the second xmlhttprequest
            secondRequest.send(secondRequestContent);

        });
    }
};

1

solved Send one file of Dropzone to multiple urls