note 28431 deleted from function.header by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Mon, 13 Jan 2003 21:00:58 +0000 |
| Subject: | note 28431 deleted from function.header by jmcastagnetto | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42081@lists.php.net to get a copy of this message | ||
Based on the above notes, I have a working script that forces downloaded data to be saved as a file:
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
header("Last-Modified: " . gmdate('D,d M Y H:i:s') . ' GMT');
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: Application/octet-stream");
header("Content-Disposition: attachment; filename=file.csv");
readfile($filename);
Now I want to do the same thing with data passed to the script as a POST variable, instead of from a
file. This opens a blank window instead of prompting a file save, and I cannot understand why:
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
header("Last-Modified: " . gmdate('D,d M Y H:i:s') . ' GMT');
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: Application/octet-stream");
header("Content-Disposition: attachment; filename=file.csv");
echo $_POST["csv_string"];