I'm looking to add a "Download this File" function below every video on one of my sites. I need to force the user to download the file, instead of just linking to it, since that begins playing a file in the browser sometimes. The problem is, the video files are stored on a separate server.
Any way I can force the download in PHP?
You could try something like this:
I just tested it and it works for me.
Please note that for
readfile
to be able to read a remote url, you need to have yourfopen_wrappers
enabled.