In the HTML, javascript + css forum someone told me that to make a download dialogue box pop up when a page is opened you can use the following script:
$file is the actual file (with the path included)
$new_filename is the filename that you want to send to the user. So when they download this will be the name used by the browserthe first 3 headers force the browser to download the file each and every single time, eg it's not pulling it from the memory/dish cache
the content type is just sent as some binary data type
the content-disposition tell the browser to force a download, do not open in the browser, even if you have a plugin to open it.i use this script for images, word documents, pdfs and it works just fine.
if (is_file($file)) { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$new_filename); readfile($file); exit(); }
How do I put this into my HTML page?
Martin