title: cannot create a directory using mkdir
body: <p>So I'm trying to develop a script where all users can upload an image to a dynamically created folder.</p>
  
  <p>Here is the line I made.</p>
  
  <pre><code>$newID = 1
  mkdir('uploads/job_images/'.$newID.'/',0755);
  </code></pre>
  
  <p>This will create a folder inside "uploads/job_images" which is already set up.</p>
  
  <p>My problem is that if "job images" permission is set to 755 or 766 it wont let me create a directory.
  But when I try to set the "job_images" permission to 777 it allows me to create a directory. But they say 777 is a security risk. Why do you think I cant create a folder inside "job_images" if permission is set to 755 but allows me to create a folder inside "job_images" if "job_images" permission is set to 777?</p>
  
  <p>The created folder also have the "owner/group" set to 99/99(nobody). Is that owner group okay?</p>
  
  <p>Questions:</p>
  
  <ol>
  <li>Can I do it without using 777 to "job_images" folder or leaving it to 777 is okay?</li>
  <li>Do I need to change the owner of the created folder? I might someday need to delete those folders.</li>
  <li>How do I default the group of those created folders by the users of the website?</li>
  </ol>