Re: Request for Help/Information

From: Date: Wed, 04 Aug 2004 18:59:42 +0000
Subject: Re: Request for Help/Information
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192737@lists.php.net to get a copy of this message
On Wed, 4 Aug 2004 09:04:33 -0500, Andy Baldwin <andy@questasoftware.com> wrote: > Would someone be willing to suggest a solution to a coding problem? > > After the following code (downloads a text file from the host server to > my PC), how can I redirect the script to another one? > > <?php > $user_agent = strtolower($_SERVER["HTTP_USER_AGENT"]); > header("Content-type: application/force-download" ); > if((is_integer(strpos($user_agent,"msie"))) && > (is_integer(strpos($user_agent,"win")))) { > header("Content-Disposition: filename=" . $filename); > } else { > header("Content-Disposition: attachment; filename=" . $filename); > } > header("Content-Description: File Transfer"); > @readfile($filename); > ?> > > I have tried without success: > header("Location: Echo_UploadBatch.php?filename=" . $filename); > > Any help would be appreciated! > Short answerL you can't. If you download a file from a script, you can do only that, you can't output HTML, javascript, or any redirection headers. That being said, it *may* be possible to send a multipart response with a file and redirection, but I'm not sure of this at all. AFAIK, the browser shouldn't display a blank page when you download a file as long as it's in an exising window. It should stay on the page where you clicked the "download" link. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.general (#192737) next »