RE: [PHP] File Download Completion
| From: | Boaz Yahav | Date: | Wed, 31 Jan 2001 19:45:13 +0000 |
| Subject: | RE: [PHP] File Download Completion | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37524@lists.php.net to get a copy of this message | ||
All of the examples on weberdev.com use a download script that
should send the file like you describe. This used to work but now
that I'm testing it, It seems that instead of the file name I get
the script name.htm or something else. The only thing that has
changed is that I upgraded to 4.0.4pl1
any idea?
-----Original Message-----
From: Daniel Grace [mailto:dewin@oldbattery.com]
Sent: Wednesday, January 31, 2001 2:37 PM
To: php-general@lists.php.net
Subject: Re: [PHP] File Download Completion
"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
--
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