File and HTML document from one script
| From: | Dietmar Rahlfs | Date: | Mon, 05 Jun 2000 08:14:44 +0000 |
| Subject: | File and HTML document from one script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-1025@lists.php.net to get a copy of this message | ||
Hello,
I´m new to this list. Hello all!
I am just writing a PHP4 script forup and downloading
files. Now I am encountering the following problem:
I want to download a file with IE5 and NN4.72 under
Windows 98. Simultanously I want to make appear the
"Save as" window and an HTML page in the original
browser window. The name of the file to save should
be set to be the original file name.
I have coded the following:
<?php
header("content-type: application/octet-stream");
readfile("/bin/pwd");
header("something");
?>
HTML code
I guess I have to close the document anyhow
before sending the second header,
but document.close() with JavaScript doesn´t
prevent an error message that the second
"header" line be erroneous because there
have been data in the document before.
Then the "Save as" windows takes as default
file name the name of the PHP script, and
even when is have changed the file type mask
to *.* "pwd" gets saved as "pwd..php3".
At last, a bit off-topic: Although I sent
"application/octet-stream" as content type
the file content appears in the IE5(!) browser
windows when I want to download a text or
HTML file. Can I change this behaviour?
Dietmar Rahlfs