I currently have some code in a document management system that is used to check-out a document. It looks like this:
//Update the status of the document $query = "UPDATE $table_data SET status = '$SESSION_UID' WHERE id = '$id'"; $result=&$conn->Execute($query); //Download the document. header ("Content-Type: application/octet-stream"); header ("Content-Disposition: attachment; filename=$realname"); readfile($filename); The problem I am having is that when the download is canceled by the user the document still shows up as being checked out. Is there a way to know if the document has been successfully downloaded before I update the database. Something like: //Download the document. header ("Content-Type: application/octet-stream"); header ("Content-Disposition: attachment; filename=$realname"); readfile($filename); //Determine if download is successful????. Set download variable. if($download=1) { //Update the status of the document $query = "UPDATE $table_data SET status = '$SESSION_UID' WHERE id = '$id'"; $result=&$conn->Execute($query); } thanks, Luis R. Lebron