Forum Moderators: coopster
You need to send the correct header information to the browser when trying to download a file instead of having it opened.
header("Content-type: [content-type]");
header("Content-Disposition: attachment; filename=[filename]");
readfile("[file-on-server]");
You can replace [content-type] with the actual content-type of the file, this way the browser can handle it however it chooses. If you want to always force a download, then you can change this to a stream of some sort, like application/octet-stream.
Replace [filename] with the name you want their browser to save the file as by default (this can be different than the actual filename, but you should have it there otherwise it will try to save the file as the name of your PHP script that prompted the download), and replace [file-on-server] with the path and name of the file as it is on your server.