Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

375
Views
How to display uploaded document inside a dropzone form in an edit modal?

I am using the same dropzone form to upload different documents. After upload I need to open a modal for each one document to give the possibility to modify, so i show document uploaded inside the dropzone when i open the modal with this code

  $("#mydropzone").dropzone({
                    acceptedFiles: ".pdf,.tiff,.png,.jpeg,.jpg,.bmp",
                      dictDefaultMessage: "Drop files or click here to upload a new DICOM series ...",
                      uploadMultiple: true,
                      parallelUploads: 10,
                      paramName: "file",
                      autoProcessQueue: false,
                      clickable:'#dropzoneModal',
                      previewTemplate: document.querySelector('#preview_template').innerHTML,
                      init : function() {
                        modalDropzone = this;   
                            fatturaId = thisId-1;
                              for(var i=0;i<dropzones[fatturaId].files.length;i++){
                                  var mockFile = {
                                          name: dropzones[fatturaId].files[i].name,
                                            size: dropzones[fatturaId].files[i].size,
                                            status: Dropzone.ADDED,
                                            accepted: true
                                  };
                                  modalDropzone.emit("addedfile", mockFile);
                                  modalDropzone.files.push(mockFile);
                                  modalDropzone.createThumbnailFromUrl(mockFile, opts.imageURL, function() {
                                      modalDropzone.emit("complete", mockFile);
                                    })
                          }
                        }
                });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
The documents uploaded are saved in dropzones[fatturaId].files, that why i iterate it The first time the file shows correctly when i open the edit modal, while the second time the dropzone shows empty without any document in it, showing an error in console:

Uncaught Error: Dropzone already attached.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!