Hello I use the following script for downloading files with php:
$archive = tempnam("//somepath/mms_1/MMS_SERVICE/","asset");
$zipobject = new ZipArchive();
$zipobject->open($archive, ZIPARCHIVE::CREATE);
$zipobject->addFile('somefile', '');
......
$zipobject->close();
$filesize = filesize($archive);
$timestamp=date('d-m-y_H-i');
header("Content-type: application/x-zip-compressed");
header("Content-Disposition: attachment; filename=Assets_$timestamp.zip ");
header("Content-Description: Download PHP");
header("Content-Length: filesize ");
header("Content-Transfer-Encoding: binary");
readfile_chunked($archive);
unlink($archive);
The problem is that php do not delete the temp zip file when finish downloading, or when user aborts downloading, or when leave page. It seems that unlink never executes in this cases ignore_user_abort(true); function but this doesnt resolve the problem. Any one can suggest a solution for this?