I'm checking the connection_status() in my shutdown script to detect if the file I'm serving through php was downloaded or interrupted. However since the browser downloads the file during the save prompt, and it's a very small file (1mb), it's very easy to end up getting false positives where the file has finished downloading in the background, but the user clicks cancel.
Is there a way around this? By say not sending the browser the file until the user explicitly clicks save, or if there is some other mechanism to exploit.