note 30170 rejected from function.header by jsheets
| From: | jsheets@php.net | Date: | Sun, 09 Mar 2003 15:24:05 +0000 |
| Subject: | note 30170 rejected from function.header by jsheets | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-45031@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]