[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] File Download Completion
From:       "Daniel Grace" <dewin () oldbattery ! com>
Date:       2001-01-31 21:21:51
[Download RAW message or body]

On Wednesday, January 31, 2001 at 12:00 PM, "Boaz Yahav"
<berber@netvision.net.il> wrote:

> Seems like your theory doesn't stand the reality test :)
>
> This is the script which for some reason works with Netscape but not with
IE
> (it used to) :
>    ignore_user_abort(0);
>    $filename="test.gz";
>    $file="/home/examples/" . $filename;
>    header("Content-Disposition: attachment; filename=$filename");
>    header("Content-Type: application/x-gzip");
>    header("Content-Length: ".filesize($file));
>    header("Pragma: no-cache");
>    header("Expires: 0");
/*
>    $fp = fopen($file, "r");
>    if(!$fp) {
>            echo"Can't open file for read";
>            exit();
>    }
>    print fread($fp, filesize($file));
*/ // readfile($file) does the same thing.

>    echo"<BR><BR><BR><BR><H1><B>The file was downloaded
> successfully</B></H1><BR><BR><BR><BR>";
>
> For some reason it never shows the last echo weather i let the DL complete
> or stop it
> in the middle...
>

Remember that everything you are sending to the browser -- whether it be by
print, echo, readfile, or HTML code outside of <?PHP ... ?>, becomes the
file the user is downloading. If you were to open the gzip file you're
sending, you'd notice that the "<BR><BR><BR><BR><H1><B>The file was
downloaded</B> successfully</B></H1><BR><BR><BR><BR>" is being appended to
the end of that file.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic