afoysal's avatar

File upload progress bar in vue.js

I am trying to develop a Vue.js application.In this regard I am uploading file in this Application. Now I would like to develop a progress bar for that file upload feature. I am trying to follow a tutorial. Here I got axios library for upload file. The code is like below

axios.post("/upload.php",fd,{
    onUploadProgress: function() {
       //code here
    }
})

But I am using vue-resource. How can I detect upload progress in vue-resource?

0 likes
3 replies
rin4ik's avatar
this.$http.post("/upload.php",fd,{
     progress(e)  => {
        console.log(e) 
///code here
    }}
1 like
afoysal's avatar

Thanks @rin4ik and @topvillas . I tried to log like below { progress(evt) { console.log('hello') if (evt.lengthComputable) { console.log(evt.loaded / evt.total * 100); } } } . But this is not working. That means progress() is not triggered.

Please or to participate in this conversation.