title: How to create destination (Folder) in PHP while using move_uploaded_file()?
body: <p>I want to upload files with PHP and i use move_uplload_files to copy them to the destination folder I want, everything works fine with this :</p>
  
  <pre><code>if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], './uploades/'))
  die("success");
  else
  die("error");
  </code></pre>
  
  <p>But when I try this</p>
  
  <pre><code>$rand =  chr(rand(97, 122)). chr(rand(97, 122)). chr(rand(97, 122));
  if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], './uploades/'.$rand))
  die("success");
  else
  die("error");
  </code></pre>
  
  <p>I will get error, and it looks like move_uploaded_files <em>can not</em> create folders. How can I do this ?</p>
  
  <p>Basically I am looking for a way to do it like <code>file_put_contents()</code> that creates the path if not exist.</p>