Suppose for this case the apache server and php language.
I have a file on my server (Ex: formrio.pdf ) and there is a page ( formrio.php ) that has a button to download this file.
I need to get the periodic information of the number of successful downloads of formrio.pdf and update the form.php page informing this number.
Ways of implementation
The question is which of the ways below is the most recommended, taking into account ease of implementation and security:
Periodically consult the server logs regarding file downloads (If this data exists and it is safe to do so) and store the value in a database;
Remembering that in this case the answer is not necessarily a solution code for the problem, but which of the alternatives above is the most recommended (there may even be another one) and in this case, an example code can be used to help with the explanation.
I believe it's a bit of personal preference,
I would particularly prefer to create a table to store the information of these downloads, it would be much easier to get statistics or something like that.