Wrong, I don't want to know how many times users click download button but how many times they downloaded file completely. The key word here is filesize, i.e if filesize is eq to 20 Mb my script should count only when user downloaded 20 Mb of this file (no broken downloads).

In many cases, counting the number of times the download link was clicked would be sufficient, especially as a "boosted count" will often be desired when displaying to users.

In your case, you require an accurate/reliable count. It should be possible to parse the log file on your server which stores downloads. This also has its issues, i.e. if the user is using a download manager which breaks the download up into chunks, therefore producing multiple records in the log. You could design your code to recognize/handle if multiple records per download, but I don't think you would ever be able to guarantee 100% accuracy.

If you were letting users i.e. download your own written software, I would consider sending a request to the server when the program is opened for the first time, incrementing the count. But I doubt this is relevant in your case.

In conclusion, consider why you need an accurate/reliable count / what will the resultant data be used for / is there room for error at all.

You still haven't fully provided an explanation for why you need an accurate count. You state you want to recognize fully completed downloads, but why, what will you use the resultant count for (not that its any of my business, but do you "really" need it, why is it so important for you). The way I view it is, even if they downloaded the file, whos to say they will open it anyway, which is surely more important.

I was under the assumption that only completed downloads would be logged, but I could be wrong. If thats the case, you wouldn't necessarily need to compare against filesize. If you do need to compare against filesize (i.e. broken downloads), i'm not sure, sorry.