Search code examples
detectdropzone

DropzoneJS which one file is?


So, I use DropZoneJS for uploading images for individual products. But i make in database 6 columns for images

"image_1" "image_1thumb" "image_2" "image_2thumb" "image_3" "image_3thumb"

I make script for uploading images on the host and also to convert image to thumb...

So what i need. How i can detect first, second and third image? I wanna first image name to write in "image_1" and in "image_1thumb", second in "image_2" and in "image_2thumb" and third one in "image_3" and in "image_3thumb"


Solution

  • The dropzone docs mentions a list of events... one being

    complete
    

    which returns the current file So for the Dropzone post the processqueue event

     this.on("complete", function (file) {
             // this complete will be fired 3 times...in your case        
         });
    

    you can manipulate the filename here or you can store then in order and later updated your database