I have a download button in the UI, user clicks on it and download 3 files in a zip format.
It's not necessary that the files are arleady there when download button is clicked because the backend process can take sometime to put the files at a particular location on the server.
Files are going to be in following format
file1_1555077233.csv file2_1555077233.csv file3_1555077233.csv
So that each time a user clicks on the button, I can get the latest file based on the timestamp.
I am trying to figure out where exactly I should generate this timestamp?This timestamp is going to be included with the file name at the time of file generation.
The problem with this approach is that how would I know the timestamp value if a user shuts down his computer and come back later looking for files after clicking the download button ?
2) Should I have my back end java based webservice generate the timestamp as soon as it's called from the UI?
The problem with this approach is that I will need access to this timestamp on the UI side so that when a user clicks on the download button, I can make a request based on the file name and let the user know whether the file exists or not. One approach is to get this timestamp from the Java webservice in json response but this would only work when the user keeps the browser open for long time which is not ideal. Let's say user shuts down everything and come back later. How should I handle this thing ?
If there's any additional thing I would need to do(which I think I would have to) in addition to handling timestamp generation, please let me know. Thanks