I am using symlinks generated in PHP. They are generated when someone requests a download, and I want them to expire at the end of each day.
The problem is, what if someone starts downloading a symlink 1 minute before the end of the day and then I delete the symlink while they are downloading it…
My question is, to your knowledge will that individual downloading the symlink, right before I delete it, still be able to “download” the file? I am not worried about “resumable download” capability.. but will it make their download stop or break in some way?
Yes you can do this.
On UNIX-like systems (including Linux), you don’t delete files. You delete filenames. If you delete a file that someone else currently has open, the filename will be gone but the data will remain on disk until the file is closed.
Even more so with symlinks: if you delete a symlink the file data is still there, and any process with the file open refers to it by a file handle, not by filename.
So as long as you delete the symlink after your script opens the file, the download will complete without any trouble.