views:

53

answers:

1

Possible Duplicate:
how to know when download is finished

Hi,

I have a file which I want users to download only once. After it's done downloading, the file is no longer available.

Outside of setting up a streaming system, is there any way I can set some sort of callback up to say the file is done downloading on the client's computer?

Thanks

A: 

You can use readfile() to send the file then do what you need to do.

header( 'content-type: file/type' );
readfile($filename);
file_is_done_downloading();

It's usually best to let people download for an hour or two just to make sure they get everything, since this doesn't support resuming downloads.

sakabako