How can I use custom action on vs-upload?

628 views Asked by At

405 Method Not Allowed

  • I'm getting this error and my request url is null tho i've set the callback
  • I've also tried @action="" but I got the same result

Request URL: http://localhost:8000/callback/null

Request Method: POST

Status Code: 405 Method Not Allowed

<vs-upload automatic :action="upload" fileName="file" @on-success="successUpload" />


export default {
 methods:{
  upload (file) {
    this.$store.dispatch('some/callback', file)
  },
  successUpload() {

  }
}

500 Internal Server Error

  • Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined.

Request URL: http://localhost:8000/api/upload

Request Method: POST

Status Code: 500 Internal Server Error

<vs-upload automatic action="/api/upload" fileName="file" @on-success="successUpload" />

export default {
 methods:{
  successUpload() {

  }
}
1

There are 1 answers

0
Kamlesh Paul On

you need to add header to authorisation

i assume you are using token based auth as you are using vuejs

so solution is

 <vs-upload automatic :headers="{'Authorization' : token}" action="/api/upload" fileName="file" @on-success="successUpload" />

you need to add headers="{"Authorization" : token}"

https://lusaxweb.github.io/vuesax/components/upload.html#automatic . you can check here available params