php - How to force download of a file?
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: $file_name = 'file.avi'; $file_url = 'http://www.myremoteserver.com/' . $file_name; header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"".