Display a page first, then use the redirect header to redirect the browser to the actual file.
Merritt, Dave wrote: >All, > >I'm trying to write a script that will allow the user to download/save a >file but I also want to be able to display a web page in the browser window >as well. If a user runs the following code from an empty browser window, >then the contents of the browser window will remain empty. How do I get the >script to also output page content to the browser window as well as download >the file? I've played around with trying to add an additional text/html >content type and echoing out text in different places in the script, but I >cannot get any output to appear in the browser window. I've tried setting >the location so that the page will open another page but then I run into the >headers already sent problem. > >from the browser: >http://myhost/download.php/?Filename=/tmp/20020923172330.xls > >download.php: > ><? >$Filename = $_GET['Filename']; > >header("Content-Type: application/force-download"); >header("Content-Type: application/octet-stream"); >header("Content-Type: application/download"); >header("Content-Disposition: inline; filename=" . basename($Filename)); >header("Content-Transfer-Encoding: binary"); >header("Content-Length: " . filesize($Filename)); >header("Pragma: public"); >header("Expires: 0"); >header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); > >readfile("$Filename"); >?> > >Thanks > >Dave Merritt >[EMAIL PROTECTED] >************************************************************************************************** >Any views, opinions or authorizations contained in this email are solely those of the >author and do not necessarily represent those of ArvinMeritor, Inc. If you are not >familiar with the corporate authority of the author, please obtain confirmation in >writing >of the content of this email prior to taking any action on the basis of the >information. If >you are not the intended recipient, you are hereby notified that any disclosure, >copying >or distribution of the information enclosed is strictly prohibited. >************************************************************************************************** > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php