Exoon Posted February 19, 2009 Share Posted February 19, 2009 Hello, Ive got an image upload script and im trying to make it so when i upload an image it checks if the game folder already exists, if it dosen't i want it make a folder with the game name and put the image into that folder. I had it working fine without the making the directory, but ive added this bit of code if (!file_exists("../images/games/$game_name/")) { //make the directroy mkdir("../images/games/$game_name/", 0777); } And its now making a directory but any images that go into that folder get given the wrong permissions and i lose ownership so i cannot edit the image any way. If i go into my directory admin and click "Reset Ownership" it then lets me delete/rename the image and its permission attributes. How can i get it so when the image is uploaded into the folder created by the mkdir function it gives the permissions to me so i can delete/rename it whenever i want too. Thanks in advance edit: When i look in directadmin the UID and GID is apache, while everything else is "gamer" Link to comment https://forums.phpfreaks.com/topic/145923-mkdir-permissions-problem/ Share on other sites More sharing options...
Exoon Posted February 19, 2009 Author Share Posted February 19, 2009 Anyone got any ideas what i can do to fix this? Ive been looking all day Link to comment https://forums.phpfreaks.com/topic/145923-mkdir-permissions-problem/#findComment-766410 Share on other sites More sharing options...
marcus Posted February 19, 2009 Share Posted February 19, 2009 http://php.net/chmod Link to comment https://forums.phpfreaks.com/topic/145923-mkdir-permissions-problem/#findComment-766415 Share on other sites More sharing options...
Exoon Posted February 19, 2009 Author Share Posted February 19, 2009 Hello, Is is an ownership problem, Once the file has been uploaded it belongs to Apache and not me, therefore i cannot access it via the FTP. Any other ideas? Ive tried chown,chmod etc etc Link to comment https://forums.phpfreaks.com/topic/145923-mkdir-permissions-problem/#findComment-766459 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.