note 32276 added to function.header
| From: | rajka at 6deex dot net | Date: | Thu, 22 May 2003 11:56:34 +0000 |
| Subject: | note 32276 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48811@lists.php.net to get a copy of this message | ||
I was trying to download a CSV file using IE6 SP1, but it was displayed in the window by excel: I
was using "Application/octet-stream" as Content-type. So after a little search, I found a
type/subtype pair that works, the code looks like this:<br>
header("Content-type: text/tab-separated-values");
header("Content-Length: ".filesize($fpath));
header("Content-Disposition: filename=".basename($fpath));
readfile($fpath);
exit;<br>
I stripped out every error check, just to shorten the code. None of the users notes worked for me, I
hope this will be useful for somebody.
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32276
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32276&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32276&report=yes