At 00:52 24.02.2003, Anthony Rodriguez said: --------------------[snip]-------------------- >In PHP, is there a way to allow the user to download a demo file (e.g.: >sample.exe) to their computer? And, then, automatically return to the Web >site? --------------------[snip]--------------------
A couple of. Generally a browser will not leave the current page when starting a file download - it simply remains on the page. As for your question: 1) Generate a link to the exe file within your HTML output: echo '<a href="sample.exe">Get the sample.exe file</a>'; 2) If you don't have a "file" but need to construct it on the fly (or it is not directly accessible from within your webserver), simply echo out the data after sending an appropriate MIME headers. Assuming you have the file contents in a variable called "$export": header('Content-Type: application/octet-stream'); header('Content-Length: ' . strlen($export)); header('Content-Disposition: attachment;filename="sample.exe"'); echo $export; exit(); -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php