PHP: generated zip has chmod 644

爷,独闯天下 提交于 2019-12-25 06:53:17

问题


I'm using ZipArchive to create Zips and then provide them to download. I save them in a folder and I want to delete all every night (my cronjob would do that).

But now I've seen that they are created using CHMOD 644, and if I try to delete them with my script, I always can't delete them because I do not have sufficient rights.

How can I declare that every new Zip which is created uses 777?

Thanks for help! Flo


回答1:


Are you able to chmod it like so?

chmod("/somedir/somefile", 0777); 



回答2:


The ability to delete files from a directory depends on the permissions of the directory, not the individual files inside. If your directory is 0777, you'll be able to delete the files regardless of their permissions. On the other hand, even if your files are 0777, you might not be able to delete them if your directory is unwritable to your cronjob.



来源:https://stackoverflow.com/questions/8038467/php-generated-zip-has-chmod-644

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!