Jump to content

mkdir permissions problem


Exoon

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.