On Wed, 4 Aug 2004 09:04:33 -0500, Andy Baldwin <[EMAIL PROTECTED]> 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--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to