2

When I upload the image using dropzone then the image name will be displayed. When I closed the modal then I want to remove the last uploaded image.

Problem

How I manually trigger removedfile function example link

Code

 // open create folder modal
    $('.js-upload-file-btn').on('click',function () {
        $(".js-upload-file, .modal-backdrop").addClass("open");
    });

    // close all modal
    $(document).on('click','.modal .close',function () {
        $(".modal, .modal-backdrop").removeClass("open");
 
    });


    Dropzone.autoDiscover = false;
    try {
        var myDropzone = new Dropzone("#dropzone" , {
            paramName: "file", // The name that will be used to transfer the file
            maxFilesize: .5, // MB

            addRemoveLinks : true,
            dictDefaultMessage :
                '<span class="bigger-150 bolder"><i class=" fa fa-caret-right red"></i> Drop 
                files</span> to upload \
                <span class="smaller-80 grey">(or click)</span> <br /> \
                <i class="upload-icon fa fa-cloud-upload blue fa-3x"></i>'
            ,
            dictResponseError: 'Error while uploading file!',

            //change the previewTemplate to use Bootstrap progress bars

        });
    } catch(e) {
      //  alert('Dropzone.js does not support older browsers!');
    }
Mukkaram Waheed
  • 483
  • 7
  • 31
  • 2
    Hi, use `myDropzone.removeAllFiles( true );` inside `$(document).on('click','.modal .close',function () {` .Also put this event after dropzone code . – Swati May 06 '21 at 05:13

0 Answers0