note 30170 added to function.header
| From: | dion at NOSPAM dot example dot com | Date: | Sun, 09 Mar 2003 11:18:10 +0000 |
| Subject: | note 30170 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45026@lists.php.net to get a copy of this message | ||
i want to force a file download and a subsequent automatic redirection to an (exit) webpage. any
suggestions?
these 2 cases do not work:
1. this one redirects but does *not* download
[code]
ob_start();
header( "Content-Disposition: attachment; filename=hi.txt");
$fp = fopen($outfile_path, 'r');
fpassthru($fp);
header( "Location: http://www.google.com");
ob_end_flush();
[/code]
2. this one downloads but does *not* redirect
[code]
ob_start();
header( "Content-Disposition: attachment; filename=hi.txt");
$fp = fopen($outfile_path, 'r');
fpassthru($fp);
ob_end_flush();
ob_start();
header( "Location: http://www.google.com");
ob_end_flush();
[/code]
--
http://www.php.net/manual/en/function.header.php
http://master.php.net/manage/user-notes.php?action=edit+30170
http://master.php.net/manage/user-notes.php?action=delete+30170
http://master.php.net/manage/user-notes.php?action=reject+30170