Answers for "upload progress with axios"

2

js axios progress

upload(files) {
  const config = {
    onUploadProgress: function(progressEvent) {
      var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
      console.log(percentCompleted)
    }
  }

  let data = new FormData()
  data.append('file', files[0])

  axios.put('/endpoint/url', data, config)
    .then(res => console.log(res))
    .catch(err => console.log(err))
}
Posted by: Guest on October-09-2020
0

File uploading progress with axios

const config = {
    onUploadProgress: progressEvent => console.log(progressEvent.loaded)
}
Posted by: Guest on May-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language