The question says it all.
How do I let the users download a file from my website and not let them see what link that file comes from?
I understand that there might be a need for something like a download.php which will serve as the gateway but past that phase, I dont know what to script next…
If it bothers you to write the whole code, a few function names that I should need to use would be really handy!
Find a way to identify the file to download (for instance, a GET variable that matches the ID of a row in a database, or something along these lines). Make damn sure it’s a valid one, because you don’t want your users to be able to download anything off your site. Then, use
headerwithContent-Dispositionto tell the browser the file should be downloaded, andreadfileto output it.For instance: