vue-dropzone icon indicating copy to clipboard operation
vue-dropzone copied to clipboard

vdropzone-file-added Triggering before validating the image

Open nithinkvarrier opened this issue 4 years ago • 1 comments

I had created a function onImageAdded() in vdropzone-file-added event

async onCoverImageAdded(upload) {
     
      console.log(upload);
     console.log(upload.accepted);
      
      if (upload.accepted) {
      console.log('valid image');
      }else{
console.log('Invalid image');
}

}

here upload.accepted condition always return undefined. But within a fraction of seconds 'upload' data got updated to accepted = true. If I'm adding setTimeout before the code it's working perfectly. Just like this

async onCoverImageAdded(upload) {
     setTimeout(async function() {
      console.log(upload);
     console.log(upload.accepted);
      
      if (upload.accepted) {
      console.log('valid image');
      }else{
console.log('Invalid image');
}
}, 0);
}

How do I validate an image is valid before moving this into server?

nithinkvarrier avatar Feb 11 '21 15:02 nithinkvarrier

Facing the same issue. Any solution?

i-m-soumya avatar Mar 20 '21 17:03 i-m-soumya