Tracking progress when uploading files
See original GitHub issueIs it possible to listen to the upload progress event given by the xhr object?
Normally it is done like this:
xhr.upload.addEventListener('progress', handler);
I know that the xhr object is returned by end()
and in the response
object. The latter fires only when the response is received though (which makes sense).
Any ideas?
Issue Analytics
- State:
- Created 9 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Uploading files with progress monitoring in VanillaJS, Angular ...
So, in this post we will see how to upload files asynchronously with JavaScript with progress monitoring. Step 1: Our backend. Yes, we...
Read more >File upload progress bar with jQuery - Stack Overflow
I've done this with jQuery only: $.ajax({ xhr: function() { var xhr = new window.XMLHttpRequest(); xhr.upload.addEventListener("progress", function(evt) ...
Read more >Tracking file upload progress using axios - gists · GitHub
Tracking file upload progress using axios. GitHub Gist: instantly share code, notes, and snippets.
Read more >Adventures in Tracking Upload Progress With OkHttp and ...
This article tells the story of how Stream's Android team refined our progress tracking process during file uploads in the Stream Chat ...
Read more >Tracking Upload Progress in Browsers | Siaw Young
loaded, evt.total]); }); } }} > Upload file </button> <input type="file" name="myfile" onChange={e => { if (e.target.files && e.target.files.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. superagent fires
progress
events through it’s eventemitter.Basically:
See https://github.com/visionmedia/superagent/blob/master/lib/client.js#L756-L770
@similityman Alternative to @teonik’s solution, you can use a bound function (arrow function) when attach the superagent onprogress handler. This can also give you a chance to bind extra params to your onprogress handler if you need references to anything.
I personally chose to fire off individual requests for each file upload in my own app so I could render progress per file. I used the second method to bind a uuid to each file so I could map the progress emitted to the correct file in the uploading queue. Not sure how valuable copy/pasting that example will be, but hey… sharing is caring!