Page 1 of 1

Close window after download

Posted: Mon Jul 05, 2004 11:31 am
by pickle
Hi All,

Here's what I want to do:

A user clicks a link to download some text (from a PHP file)
That PHP file generates the text, and dumps the content. The user is then prompted to download the file.

Code: Select all

<?PHP
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=test.txt");
echo "Contents of file";
?>
However, this is where my problem is. After the user has downloaded the file, they're stuck with a big dump blank window in the middle of their screen. Is there any way to get rid of this window?

Posted: Mon Jul 05, 2004 12:31 pm
by qads
have you tried linking to it directly? without opening a window? i had this problem aswell, i just linked to the php page and it works.

Posted: Mon Jul 05, 2004 12:40 pm
by pickle
" Let the bells ring out
and the banners fly,
Qads, Qads,
Is quite a guy!"

It worked (as you may have already guessed). Thanks a bunch.

Posted: Tue Jul 06, 2004 5:13 pm
by qads
lol, np :D