Re: File Download Completion
| From: | Daniel Grace | Date: | Wed, 31 Jan 2001 12:36:35 +0000 |
| Subject: | Re: File Download Completion | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37466@lists.php.net to get a copy of this message | ||
"Boaz Yahav" <berber@netvision.net.il> wrote in message
news:EEC6EBAB1A35E94789FB2872A1698F75145164@ntx2.netvision.net.il...
> 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