The principle of the script is:

The script loads the file into a temporary folder and after clicking the button the user moves from the temporary folder to the permanent function rename and everything works as it should. The fact is that after the file has been moved to the permanent directory, the script performs some more operations and if something goes wrong, the downloaded file is deleted. In my case, I get the following error in trying to delete the Warning: unlink(путь к файлу): Permission denied file Warning: unlink(путь к файлу): Permission denied

It would seem that there is a problem with access rights, but no! With the rights, everything is in order.

The fact is that if you write manually in some kind of php file unlink(путь к файлу который не удалось удалить в первый раз) then everything is deleted without any errors.

I’ve managed to understand a little bit (but I’m not sure) that the rename function after transferring the file continues to block it and therefore the file cannot be deleted. In the documentation off, it is not stated anywhere that this function locks the file and there are no ways to release it.

What are your thoughts? Is there a solution for this problem?

  • one
    see the code that rename renders? - Naumov
  • Not sure if it will seem useful
  • one
    ok ls -l zips/file.zip what does it say to make sure, and where is the unlink() chunk? the code can lead at least in fragments, otherwise we will be guessing for a long time, and maybe the variable is not the same, but maybe that or maybe it is in general. - Naumov

0