Hello,
This is a reply to an e-mail that you wrote on Wed, 30 Jul 2003 at
14:43, lines prefixed by '>' were originally written by you.
> I tried changing the code to:
> // send headers to browser to initiate file download
> header ("Content-Type: application/octet-stream");
> header ("Content-Disposition: attachment; filename=$realname");
> readfile($filename);
> if(connection_aborted()==0)
> $query = "UPDATE $table_data SET status = '$SESSION_UID'
> WHERE id = '$id'";
> $result=&$conn->Execute($query);
> But it still doesn't work as expected. What am I doing wrong?
It is executing your if(connection_aborted()==0) as soon as it
gets to it when parsing the code instead of when the connection with
the broswer terminates. You need to use
register_shutdown_function() as well. I tested this code...
<?php
register_shutdown_function("myshutdown");
header ("Content-Type: application/octet-stream");
readfile("verybigfile.mpg");
function myshutdown(){
if(connection_aborted()==0){
exec ("net send ZXC connection_aborted()==0");
} else {
exec ("net send ZXC connection_aborted()!=0");
}
}
?>
..and it worked fine. Notice I used "net send ZXC" (ZXC is my
Windows computer name) as you cannot echo after the connection has
closed.
HTH
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php