How to get server response from DropzoneJs for chunk uploads


web development

After much struggling, here’s the magical formula we got for getting the server response back for chunck uploads:

var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
    thumbnailWidth: 80,
    thumbnailHeight: 80,
    parallelUploads: 20,
    previewTemplate: previewTemplate,
    autoQueue: false, // Make sure the files aren't queued until manually added
    previewsContainer: "#previews", // Define the container to display the previews
    clickable: ".fileinput-button", // Define the element that should be used as click trigger to select files.
    paramName: 'file',
    chunking: true,
    forceChunking: true,
    url: upload_url,
    maxFilesize: 1025, // megabytes
    chunkSize: 1000000, // bytes
    init: function () {
        this.on("complete", function (file){
          console.log(file.xhr.response);
        });
    }


})

Written by

Abdur-Rahmaan Janhangeer

Chef

Python author of 7+ years having worked for Python companies around the world

Suggested Posts

Build A Note App In Flask As Fast As It Can Get (Using Shopyo)

Shopyo is a framework to get started with Flask really quick. It includes several libraries to get s...

Read article

An Advanced Flask App: Shopyo

Shopyo is an Open Source Flask-based, Python-powered inventory solution and upcoming point of sales...

Read article

How to Integrate Tinymce 5 with Flask (with csrf)

This article shows how to integrate Tinymce 5 with Flask even including csrf protection! Text area <...

Read article
Free Flask Course