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));
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...
berber
-----Original Message-----
From: Daniel Grace [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 31, 2001 2:37 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] File Download Completion
"Boaz Yahav" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is it possible to find out if a client finished to DL a file?
>
> Suppose i put a link to a file and people start to DL the file.
> Some people can stop the DL in the middle. I need to know
> how many people completed the DL.
>
> Any simple ideas how to do this?
>
> thanks
>
> berber
>
One option could be to use ignore_user_abort:
<?PHP
ignore_user_abort(0); // Script will be aborted if transfer fails for
whatever reason
?>
blahblahblahyaddityyaddiy yaddity
<?PHP
// If we're this far, it means the file's more or less transferred all the
way.
file_did_download();
?>
Caveats with this:
1. Your file has to be part of the PHP page (though not neccessarily in the
file itself, header("content-type: blah/blah"); combined with
readfile($filename) will do the trick I think.
2. You (probably) can't use programs that are capable of resuming file
transfers. If you can somehow, I have NO idea how it'll react.
3. If the user aborts right after the file_did_download() function is called
but before the script actually terminates, things can go awry. I'm not
entirely sure how this would be handled.
--
- Daniel Grace <http://dewin.oldbattery.com/>
"Space may be the final frontier but its made in a Hollywood basement."
- Red Hot Chili Peppers - Californication
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]