I am trying to get the results of a variable to automatically tell the browser to download the results instead of trying to display them in the browser. I can not get it to do anything but display the results. Here is what I have so far. I hope that somebody can help me with this (probably simple) task.
I am trying to get the results of a variable to automatically tell the browser to download the results instead of trying to display them in the browser. I can not get it to do anything but display the results. Here is what I have so far. I hope that somebody can help me with this (probably simple) task.
----code snippet----
<?
header('Content-Type: application/octetstream');
header('Content-Disposition: inline; filename="database.sql"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
require("../globals.inc");
$result = `mysqldump -q -u$userName -p$password -h$hostName $databaseName`;
echo nl2br($result);
?>
---end code snippet----
Thank You in advance.
Steve
I've often used Apache's send-as-is content type (you need to have the module loaded).