More specifically, if a user cancels a download started with fopen.
I have script after the fread is done that needs to be executed. When a user starts the download but hits cancel the script following never get's called. Is there a way to run code in such an event? Or am I doomed in this reguard?
Code: Select all
//Code to set variables here
$fileSize = fileSize($path);
//create the header
header("Content-Type: $fileType");
header("Content-Disposition: attachment; filename=$fileName");
header("Content-Length: ".$fileSize);
header("Content-Transfer-Encoding: binary");
//send it
$fo=fopen($path,"rb");
print fread($fo, $fileSize);
fclose($fo);
//More code down here