diff --git a/src/services/ngx-uploader.ts b/src/services/ngx-uploader.ts index e25c62db..5695cb97 100644 --- a/src/services/ngx-uploader.ts +++ b/src/services/ngx-uploader.ts @@ -60,9 +60,10 @@ export class NgUploaderService { xhr.upload.onprogress = (e: ProgressEvent) => { if (e.lengthComputable) { if (this.opts.calculateSpeed) { - time = new Date().getTime() - time; + const diff = new Date().getTime() - time; + time += diff; load = e.loaded - load; - speed = load / time * 1000; + speed = load / diff * 1000; speed = parseInt(speed, 10); speedHumanized = this.humanizeBytes(speed); }