I want to unlink (delete) my temporary file but php throws the error :
Warning Error: unlink("my file path"\Temp\TMPAF91.tmp): Resource temporarily unavailable in ["my file path"\myscript.php, line "number"]
$tmpfile = tempnam(sys_get_temp_dir(), 'zipfile');
file_put_contents($tmpfile, $content);
$zip = new ZipArchive;
if ($zip->open($tmpfile) === true) {
// my code in here to extract the $content of the $tmpfile
$zip->close();
}
unlink($tmpfile);
I'm not sure what's happening here. The ZipArchive is closed so surely I should be allowed to unlink it.