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

How to replace current file?

Open alucardu opened this issue 3 years ago • 2 comments

I have set my options with maxFiles: 1 and when I drop more than 1 file I get a message You can not upload any more files. but I still have multiple images in my dropzone:

image

Is there an easy way to replace the current uploaded file with a new file?

What I've tried is to add a file added event and than remove the current file:

<dropzone
  id="c-dropzone"
  ref="dropzone"
  :options="options"
  :include-styling="false"
  @vdropzone-file-added="added()"
>
  <slot />
</dropzone>

methods: {
  added (file) {
    console.log('You uploaded a file!')
    this.$refs.dropzone.removeAllFiles()
  }
}

But when I run this code the image that's being uploaded is removed...

alucardu avatar Feb 12 '21 00:02 alucardu