一种下载文件并验证downoad是否成功或已被取消的方法

Is there a way to download file and a way to 'track' that download progress and see if download is completed/successful or if it was canceled?

I'm in a position where I should update a state of the file in db upon successful download and I find it very hard to acquire the best way on how to accomplish that.

Over past few days I've been all over the stackoverflow and found very interesting answers, like:

What is then the right approach/technology/... to detect successful download and update a db table?