Question on manually instantiating a file download
| From: | Vikram Vaswani | Date: | Tue, 27 Mar 2001 12:51:53 +0000 |
| Subject: | Question on manually instantiating a file download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45716@lists.php.net to get a copy of this message | ||
Hello all,
I am working on a script which locates a file on the system and then tells
the browser to pop open the "Save As" dialog box for download. In order to
do this, I am using the following code:
$filename = $dataDir . $id . ".dat";
header ("Content-Type: application/octet-stream");
header ("Content-Disposition: attachment; filename=$filename");
readfile($filename);
This works fine - however, I would like to redirect the browser to another
page once the download is complete (or once it starts). I have tried adding a
header("Location:next.php")
line to the end of the script above, but it has no effect whatsoever (after
the download is complete, the browser displays an hourglass as though
waiting for something). Do I need to send some kind of "end-of-download"
header...or something else?
Can anyone suggest some possible solutions to this problem?
Please CC a copy of your response to
bacchus@vsnl.com
as well as the list (as I will be working on this @ home also and do not
have access to the full digest there)
Any help will be much appreciated. TIA,
Vikram Vaswani
--
Sex is like air. It's only a big deal if you can't get any.