how to get onUploadProgress in axios vue

Viewed 122

But when it shows up in progress in axios it not work

show for me in console.log : app.js: 80199 POST https://s5.example.com/upload/01 net :: ERR_CONNECTION_RESET

Javascript code:

    this.video = event.target.files[0];
const data = new FormData();
data.append("file", this.video);
data.append("key","1pv6gzpm7mmynwa1l");


const config= {
headers: {
'content type': 'multipart/form data',
} ,
onUploadProgress: (progressEvent) =>
console.log (progressEvent.loaded),
} ;

wait axios
.post (this.urlUpload, data, config)
then ((response) => {
this.showSuccess (response.data.message);
})
. catch ((error) => {
this.showError(Error);
});

And please be aware after we clear the onUploadProgress line: (progressEvent) => console.log (progressEvent.loaded), From config everything works fine but I want to show progress

0 Answers
Related