iOS - How to find the estimated time left for uploading a file

785 views Asked by At

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

There are 2 answers

0
Salmaan On BEST ANSWER

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...

7
wildBillMunson On

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.