Calculate time remaining on file upload

I’m uploading Videos via native File Uploader and I have a progress bar with % of upload already. I’m wondering how I can add a calculation of time remaining for the upload?

Also, perhaps how much data in MB’s is left to upload also.

Guessing I’ll have to calculate current users internet speed etc.

1 Like

Hey @jordan18 :wave:

What you can do is run a workflow every second (while the file is uploading) to calculate the remaining time and size based on 3 things:

  • Total size (TS)
  • Elapsed time (ET)
  • Upload progress (UP%)

The remaining time formula will be:

[(ET) / (UP%)] - (ET)

The remaining size formula will be:

[ 1 - (UP%)] * (TS)

Imagine you are uploading a 10MB file…


Second 1:
Total Size: 10MB
Elapsed time (ET) = 1 second
Upload progress (UP%) = 5%

[(ET) / (UP%)] - (ET)
[1 / 0,05] - 1
19 seconds remaining

Explanation: If 5% = 1 second, 100% = 20 seconds. If already elapsed 1 second, the remaining time is 19 seconds.

[ 1 - (UP%)] * (TS)
[1 - 5%] * 10MB
9,5MB remaining

Explanation: If you already uploaded 5%, you have 95% to go. 95% of 10MB is 9,5MB


Second 2:
Elapsed time (ET) = 2 seconds
Upload progress (UP%) = 8%

[(ET) / (UP%)] - (ET)
[2 / 0,08] - 2
23 seconds

Explanation: If 8% = 2 second, 100% = 25 seconds. If already elapsed 2 seconds, the remaining time is 23 seconds. Note that, in this example, the speed is decreasing…

[ 1 - (UP%)] * (TS)
[1 - 8%] * 10MB
9,5MB remaining

Explanation: If you already uploaded 8%, you have 92% to go. 92% of 10MB is 9,2MB


Hope it helps!

1 Like

Thanks so much for the detailed response, really appreciate it. I’m in an intermediate learning phase of Bubble. Would you mind dumbing it down for me and explaining how to put it into a workflow?

FileUploaderA is my input