title: How can I extract a file zip into a directory created before by code (PHP)?
body: <p>I want to extract a file zip into a directory created before by code using PHP but it doesn't work. I think that it's a problem of permissions because if I create that folder manually it work, instad if I create it from my script it doesn't work!</p>
  
  <pre><code>....
  $filename = $_FILES["userfile"]["name"];
  $source = $_FILES["userfile"]["tmp_name"];
  $name = explode(".", $filename);
  $target_path = "Apps\\" . $username . "\\" . $name[0]; 
  
  if(move_uploaded_file($source, $target_path))
  {       
      $zip = new ZipArchive();
      $x = $zip-&gt;open($target_path);
      if ($x === true)
      {
         $zip-&gt;extractTo("Apps\\".$username); &lt;- ERROR ON THIS LINE
         $zip-&gt;close();
      }
   ....
  </code></pre>
  
  <p>This is the error:(Warning: ZipArchive::extractTo(): No such file or directory)</p>
  
  <p>How can I resolve it?</p>
  
  <p>Thanks!</p>