Jump to content

Creating folders using PHP code [problem]


abdullahc

Recommended Posts

OS: Redhat

host: Rackspace

PHP version 5.1

framework: codeigniter

 

 

we are trying to create folders for users to upload photos etc for signed up users.

below is the code we are using. Could this be a code issue, we have checked the server folder CHMODs

Your thoughts are appreciated and we thank you in advance.

 

1.  we've used chmod -R 0777 users from SSH so that the users directory is writable from script.

2. When someone registers, say with username of phpmaster, a folder is created in the users directory with 0777 permission from code

3. On the subsequent line, another directory is created within users/phpmaster named photo with 0777 permission, from code

 

In the 3rd step the folders are not created at this moment. Here is the code:

 

mkdir($this->config->item('base_path') . '/users/' . $userInfo['username'], 0777);

mkdir($this->config->item('base_path') . '/users/' . $userInfo['username'] . '/photo', 0777);

Link to comment
https://forums.phpfreaks.com/topic/94932-creating-folders-using-php-code-problem/
Share on other sites

well you dont need to specific 0777 since that is teh default.  what error message?  if its not working then it has to be throwring a message of some sort.  did you echo out the value of $this->config->item('base_path') . '/users/' . $userInfo['username'] to make sure that is actually the correct place?

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.