[Vuejs]-FilePond upload error using Validate Size plugin?

0👍

I found a simple fix for this issue when I was looking through the docs, specifically this part that discusses the methods. In the addFile method, I realized that it passes an event which contains the error if a file is too large. If the file is not too large, the event is null. So I simply do a check, remove the file and return before it gets to the point that it was causing me issues, like so:

addFile (e) {
  if (e) {
    this.error = e;
    this.$refs.filepondUploader.removeFile();
    return;
  }
  const initial = this.$refs.filepondUploader.getFile(0);
  const file = initial.getFileEncodeDataURL();
  this.$emit('handle-image-upload', file);
}

Leave a comment