pqina / vue-filepond

🔌 A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.92k stars 128 forks source link

Trigger custom error using $refs #217

Closed AO-IO closed 2 years ago

AO-IO commented 2 years ago

Hello!

I'm handling the upload manually using Formdata in a custom method that submits the data with the files.I get the file using this.$refs.pond.getFile().file and append it to formData. which is working fine 💯 .

  formData.append('FILE', this.$refs.pond.getFile().file);

so in the normal use case, the error is triggered using error() in the process method in the server object.

I'm trying to trigger an error if I catch an error in my Axios request. on my custom method.

is it possible to do something like this.$refs.pond.error('message') with a custom message to trigger the error and show it on the UI?

many thanks !

rikschennink commented 2 years ago

Hi,

Because you're handling the upload outside of FilePond there is no error state inside FilePond as the files were added successfully.

I'd advise to show an error outside FilePond if the upload fails.

I'll close the issue as it doesn't conform to the issue template. Please in the future ask questions on stack overflow and tag them with "filepond".