[Vuejs]-How to upload image file only in vuejs?

1👍

Vue itself doesn’t have the ability upload the file to your server. You can pass parameters from Vue into a POST request to a back end using method event handlers and a client like Axios, but Vue itself merely forwards the data while something like Axios would be responsible for the transfer.

There are other clients out there who can handle HTTP requests and a plethora of components out there for handling file uploads, but Axios is the one I chose as an example.

This article here might be of more assistance.

-1👍

<template>
  <vs-upload limit=1 action="https://jsonplaceholder.typicode.com/posts/" @on-success="successUpload" />
</template>

<script>
export default {
  methods:{
    successUpload(){
      console.log('success')
    }
  }
}
</script>
        

limit takes a Number not a String. Vue is terribly confusing on this subject, I know.
And Vuesax library is full of bugs, fyi.
https://lusaxweb.github.io/vuesax/components/upload.html#automatic

Leave a comment