It's called forced download and you do it like this:
PHP Code:
readfile('yourfile.ext');
header ("Content-Type: application/octet-stream");
header ("Content-Length: " . ob_get_length() );
header ("Content-Disposition: attachment; filename=$filename");
ob_end_flush();
or
PHP Code:
ob_start();
echo ('echo some stuff');
// echo more...
header ("Content-Type: application/octet-stream");
header ("Content-Length: " . ob_get_length() );
header ("Content-Disposition: attachment; filename=$filename");
ob_end_flush();
This will send the content of the output buffer to the user as $filename and will force a download dialogue. To get something into the output buffer you could either start it: ob_start() and then echo stuff.. Or you could use function readfile() (as described above)
There are better versions of the above, so try searching this forum for "force download"!
GL!
Bookmarks