Title: Directory/file creation problem
Last modified: August 18, 2016

---

# Directory/file creation problem

 *  Resolved [ratbastid](https://wordpress.org/support/users/ratbastid/)
 * (@ratbastid)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/directoryfile-creation-problem/)
 * I have a plugin that takes uploaded files via HTTP post, creates a random directory
   name for them, and moves them into that directory.
 * My PHP script runs as a user called “newtgp”, with a UID of 10006. But my directory
   gets created by the user “apache”. So when I use move_uploaded_file(), I get:
 * Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose
   uid is 10006 is not allowed to access /[redacted]/64c9ac2bb5fe46c3ac32844bb97be6bc
   owned by uid 48 in /[redacted]/wp-content/plugins/SocialPhoto.php on line 95
 * I know this is more a general PHP question than a WordPress question, but still…
   Somebody around her must have a suggestion for me. How can I make my mkdir() 
   and my move_uploaded_file() run with the same userid? I tried using rename() 
   instead of move_uploaded_file() and got the same error.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/directoryfile-creation-problem/#post-482461)
 * _I know this is more a general PHP question than a WordPress question_
 * You got that right!
 *  Thread Starter [ratbastid](https://wordpress.org/support/users/ratbastid/)
 * (@ratbastid)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/directoryfile-creation-problem/#post-482537)
 * I “resolved” this by turning off safe_mode. I’m on a dedicated box, so it’s no
   harm.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Directory/file creation problem’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [ratbastid](https://wordpress.org/support/users/ratbastid/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/directoryfile-creation-problem/#post-482537)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
