Re: File Download Completion

From: Date: Wed, 31 Jan 2001 21:21:51 +0000
Subject: Re: File Download Completion
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37538@lists.php.net to get a copy of this message
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.

« previous php.general (#37538) next »