2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00

Add 'progress' config option for monitoring progress events for uploads and downloads.

This commit is contained in:
Davis Barber
2015-07-30 13:54:53 -04:00
parent 8c1694e821
commit 261e41644d
3 changed files with 28 additions and 7 deletions
+7 -2
View File
@@ -26,7 +26,13 @@
data.append('foo', 'bar');
data.append('file', document.getElementById('file').files[0]);
axios.put('/upload/server', data)
var config = {
progress: function(progressEvent) {
var percentCompleted = progressEvent.loaded / progressEvent.total;
}
};
axios.put('/upload/server', data, config)
.then(function (res) {
output.className = 'container';
output.innerHTML = res.data;
@@ -40,4 +46,3 @@
</script>
</body>
</html>