Dynamic Delay Implementation

I am working on a project but I am not able to handle the dynamic delay concept on upload the files. I am receiving multiple files with a different line of items so maybe one file has 10 item descriptions and the other files have 50. So 10 item description file upload in 10 sec and 50 items file will upload in 20 sec currently I am handling through delay activity but this is not an actual solution because it will fail if the line of items will come more than 100 or 200.
So please provide a suitable solution .
Thanks

activity or function

do you get any message on screen when upload is completed.
like “Files Uploaded successfully” or “Upload Completed” etc.
if yes then use while activity to wait until that success element appears.

Thanks for your reply …
I have applied this activity but this is working when once screen minimizes and maximizes.
Thanks