Robert, thank you for your nice answer.
Unfortunately I don't have enough time to test it at the moment. But I believe you and paq this q.
Thank you,
Markus
PS: If you have more information or ideas please contact me. Of course you will get points for your efforts then.
PPS: Increased points to 150
Main Topics
Browse All Topics





by: ramses0Posted on 2003-01-02 at 11:38:07ID: 7657535
First and most important is readfile. Use this to start streaming the file to the user.
e
);
):
en/feature s.connecti on- handlin g.php
( "bye" ); );
, DecrementTryingToDownload, if not connection_aborted() then IncrementActuallyDownloade d). Have fun!
http://www.php.net/readfil
<?php
Header( "application/octet-stream"
Readfile( $file );
?>
Next is to look up the "set_time_limit" and some of the connection handling functions (possibly register_shutdown_function
http://www.php.net/manual/
...if the file is too large then normally PHP will probably kill the connection. I haven't tested the following, but it should probably work without much changes. You'll have to make sure you handle your IncrementDownloads and Decrement downloads.
<?php
Set_Time_Limit( 0 ); // don't drop connections
Register_Shutdown_Function
IncrementDownloads()
Header( "application/octet-stream"
Readfile( $file );
function bye(){
//this is run when the page ends
if( connection_aborted() ){
DecrementDownloads()
}
}
?>
You can even try tracking the number of current downloaders. (IncrementTryingToDownload
--Robert