safrazik / vue-file-agent

The most beautiful and full featured file upload component for Vue JS
https://safrazik.github.io/vue-file-agent/
MIT License
731 stars 93 forks source link

Any way to make use of server response without resorting to manual upload? #145

Open gutmanl opened 3 years ago

gutmanl commented 3 years ago

Hi everyone,

I'm working on a project where I need to use the server's response data after uploading a file. Is there any way to get it here without manually implementing the upload? I haven't seen any events that would be usable for this.

dimzeta commented 3 years ago

There are 2 events emitted with autoUpload: upload and upload:error. Both contains an array of responses.

<VueFileAgent
    :uploadUrl="'/api/upload'"
    :multiple="true"
    :deletable="true"
    v-model="files"
    @upload="uploadResponse('success', $event)"
    @upload:error="uploadResponse('error', $event)"
></VueFileAgent>