I'm currently working on a script (in PHP, but I'm not sure if that's relevant here) which allows users to set up a simple file-sharing system on their server. I'm stuck when trying to figure out how to deal with file downloads.
I see two possible approaches here:
1. Direct link to files on the server
Such as https://example.com/files/file.txt
2. Use a script to fetch files
Such as https://example.com/fetch.php?file=file.txt
(or alternatively creating a unique fileId which is linked to a filename in a database, and using that to fetch the file)
Which one should I use? What are the (dis)advantages of each system?