Monday, 1 February 2021

Only last file is getting uploaded to AWS S3 when trying to upload multiple files to Amazon S3 with Dropzone.js

I am using Dropzone js to upload multiple files directly to AWS S3 bucket. My code works fine only when I upload a single media. But when I try to add multiple media, only the last one gets uploaded to Amazon S3 bucket. I added debug points on several callbacks or events like "uploadprogress", "totaluploadprogress", "complete", all the media files reach at each event but seems like not all are getting uploaded. No error in console as well.

Below is my dropzone config code in javascript:

var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
        parallelUploads: 10,
        previewTemplate: previewTemplate,
        autoQueue: true, // Make sure the files aren't queued until manually added
        previewsContainer: "#previews", // Define the container to display the previews
        clickable: "#upload-media-btn", // Define the element that should be used as click trigger to select files.
        url: '#',
        method: 'PUT',
        autoProcessQueue: false,
        maxFilesize: 99999,
        maxFiles: null,
        chunking: false,
        parallelChunkUploads: true,
        addRemoveLinks: false,
        uploadMultiple: true,
        preventDuplicates: true,
        dictCancelUpload: 'Cancel',
        accept: function (file, done) {
            done();
        },
        maxfilesexceeded: function (files) {
            // to replace file if one is already selected  -- works as file replace
            this.removeAllFiles(true);
            this.addFile(files);
        }
    });

I am trying to upload media directly from my javascript code to AWS S3. Please help in resolving this issue. Basically when trying to upload multiple medias, only the last one is being uploaded and others are not reaching the AWS server at all.



from Only last file is getting uploaded to AWS S3 when trying to upload multiple files to Amazon S3 with Dropzone.js

No comments:

Post a Comment