Home  >  Q&A  >  body text

"Temporarily unavailable error while unlinking tempnam"

I want to unlink (delete) my temporary file but php throws the error:

Warning Error: Unlinking ("my file path"\Temp\TMPAF91.tmp): ["my file path"\myscript resources in Temporarily unavailable.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 going on here. ZipArchive is down, so I should definitely be allowed to unlink.

P粉309989673P粉309989673178 days ago268

reply all(1)I'll reply

  • P粉085689707

    P粉0856897072024-03-29 00:00:21

    This error only occurs on my Windows computer (version 10 in Mamp settings).

    On my Linux server (Debian Jessie distribution). This works very well.

    It also works fine on my Mac (Catalina in Mamp settings).

    reply
    0
  • Cancelreply