Open alucardu opened 3 years ago
Method removeFile(file) should do the job I give the component a data of the current uploaded file
data() {
return {
currentFile: null
}
}
Then when a new file added I remove the old one
methods: {
added(file) {
if (this.currentFile !== null) {
this.$refs.dropzone.removeFile(this.currentFile)
}
this.currentFile = file
}
}
Hope this will help
also you can do these tips
@vdropzone-file-added="addFile"
@vdropzone-removed-file="removeFile"
@vdropzone-complete="afterComplete"
just added afterComplete and then in methods
afterComplete(file) {
// we can file.status === 'error' ==> remove the first index of current file [0]
}
I have set my options with
maxFiles: 1
and when I drop more than 1 file I get a messageYou can not upload any more files.
but I still have multiple images in my dropzone: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:
But when I run this code the image that's being uploaded is removed...