Issue with File Download when cancelled
Posted: Fri Nov 11, 2005 9:21 am
I'm having an issue with fopen on my page.
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?
That's what I have. Is there a better way of doing this? Please let me know, espeically if it lets me run code in the case of a close.
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