java – Access to the latest files according to the timestamp

I have a download button in the user interface, the user clicks on it and downloads 3 files in zip format.

Files do not need to be available when the download button is clicked, because the process may take a long time to place the files in a particular location on the server.

The files will be in the following format


So, whenever a user clicks the button, I can get the last file based on the timestamp.

I'm trying to know where exactly should I generate this timestamp? This timestamp will be included with the file name at the time of file generation.

1) Should I generate it using javascript and send it at the same time as the call from the web service that is responsible for starting the main process and placing the files somewhere on the server?

The problem with this approach is that how would I know the timestamp value if a user turns off his computer and later returns to search for files after clicking the download button?


2) Do I have to let my Java-based backend web service generate the timestamp as soon as it is called from the UI?

The problem with this approach is that I will have to access this timestamp on the side of the UI so that when a user clicks on the download button, I can make a request based on the file name and the let the user know.
whether the file exists or not. One approach is to get this Java Web Service timestamp in a JSON response, but it would only work if the user kept the browser open for a long time, which is not ideal.
Let's say that the user closes everything and comes back later. How should I handle this thing?

If there is anything more that I should do (which I think I should do) besides managing the generation of timestamps, please let me know. Thank you

My front end uses just HTML, CSS, Javascript and the backend uses springboot java webservices. Let me know if I can answer more questions.