I have a scenario in which I have to inform user about how much time their file would take to successfully upload to FTP Server
using internet. I am here if someone have any idea or suggestions on how to do that? I know that it would take the size of file and the internet speed.
More suggestion are welcome.
Thanks in advance

- 2,894
- 4
- 33
- 48
-
If you want to inform *while uploading* the file, you can calculate the remaining time based on the progress so far (ie speed = bytes uploaded so far divided by elapsed time; estimated remaining time = bytes not yet uploaded divided by speed ). – Khanh Nguyen Nov 26 '14 at 06:16
-
how could i get the current upload speed of my internet connection? – Syed Ali Salman Nov 26 '14 at 06:38
2 Answers
Instead of giving an actual time estimate, I recommend using a UIProgressView object to show both overall progress and speed. Simply update the progressView.progress (which ranges from 0.0 to 1.0) each time a chunk of data is sent in your run loop. This will keep the user informed on a deeper level than simply by giving a time estimate (which would not effectively show changes in upload speed along the way).
Simply declare a UIProgressView object as a property of your uploading class, initialize it in viewDidLoad (or in the class's init method), and then use it as a standard part of your uploading process.

- 284
- 4
- 11
-
1this is not what i want. is there a way to calculate current upload speed of my internet connection? – Syed Ali Salman Nov 26 '14 at 07:23
-
Yes of course you calculate the current upload speed exactly how Khanh Nguyen described above. But this practice is not consistent with the Human Interface Guidelines that Apple has put forth; you want to keep your user intuitively connected to the rate of progress. The UIProgressView class is the best "out of the box" solution. – wildBillMunson Nov 26 '14 at 07:26
-
With due Respect, i already had implemented that, now what i want is to show estimated time left along with visible progress bar. – Syed Ali Salman Nov 26 '14 at 07:43
-
and i have a problem to get current upload speed. how do i get that? – Syed Ali Salman Nov 26 '14 at 07:44
-
The only way to know the speed is the rate of the upload itself. If you're already using a progressView, then getting the speed is easy math (bytes uploaded / elapsed time). – wildBillMunson Nov 26 '14 at 07:47
-
i want to notify user estimated time the moment he start uploading. – Syed Ali Salman Nov 26 '14 at 07:54
-
The only way to do this is by sending a packet (or packets) of data as a test case and use the time it takes as a benchmark that you can use to estimate the upload time. The more data you send in this test, the more accurate it will be, since upload speeds vary from moment to moment (quite notoriously) on iOS devices. – wildBillMunson Nov 26 '14 at 07:59
It can be done by sending packet of bytes
and see after how much time specific size
of data
is uploaded completely
, only then you can find out your upload speed
...

- 2,894
- 4
- 33
- 48

- 3,543
- 8
- 33
- 59