note 17693 deleted from function.header by jimw
| From: | jimw@php.net | Date: | Fri, 21 Dec 2001 00:59:42 +0000 |
| Subject: | note 17693 deleted from function.header by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23713@lists.php.net to get a copy of this message | ||
To specify a name when the user downloads a file via a php script, DON'T use
header("Content-Disposition: attachment; filename=\"filename\"")<br>This
header is known to break ie 5.0, 5.5, Konquerer and others (try it for yourself).<br> I
suggest the following:<br>Append '/<desired filename>' to the end of the URL
that would retrieve the file. So if you're using href="myscript.php", replace that
with href="myscript.php/foo.bar" (to have the dialog name the file foo.bar). Then you can
leave the 'Content-Disposition' header out entirely.
**NOTE: If your href has a GET variable, some browsers will use your script name instead(thus
defeating the purpose of this comment). In this case, try to reformat all your variables as if they
are sub directories of your script. Then parse the URI with <br>$array_of_vars =
split('/', $REQUEST_URI);