v-file-upload
File upload component for Vue.js.
Installation
Using yarn
yarn add v-file-upload
Using npm
npm i --save v-file-upload
Usage
As component
As service
Examples
As component
Properties
Name | Type | Required | Default | Info |
---|---|---|---|---|
url | String | True | Url to POST the files | |
thumb-url | Function | True | Method that should returns the thumb url for the uploaded file | |
accept | String | False | .png,.jpg | File input accept filter |
headers | Object | False | {} | Headers for the request. You can pass auth tokens for example |
btn-label | String | False | Select a file | Label for the button |
btn-uploading-label | String | False | Uploading files | Label for the button when the upload is in progress |
max-size | Number | False | 15728640 //15Mb | Max size for the file |
additional-data | Object | False | {} | Additional data for the request |
Events
Name | Params | Info |
---|---|---|
success | event: XMLHttpRequest event | Triggered after POST success |
error | event: XMLHttpRequest event | Triggered after POST error |
change | files: Array of uploaded files | Triggered after add or remove a file |
progress | progress: Progress percentage | Triggered while the upload is in progress indicating the upload percentage |