title: Upload Zip File and Extract the Zip
body: <p>I have a form (HTML) which submits a file to a PHP script which renames the file to ZIP, stores it in a folder (random name) and then extracts that file.</p>
  
  <p>The file gets uploaded.
  The folder is created correctly.
  The file gets renamed correctly.</p>
  
  <p>The extraction of the zip fails.</p>
  
  <p>Here is my form:</p>
  
  <pre><code>&lt;form action="up.php" method="post" enctype="multipart/form-data" name="form1" id="form1"&gt;
  
  Select file 
  &lt;input name="ufile" type="file" id="ufile" size="50" /&gt;
  
  &lt;input type="submit" name="Submit" value="Upload" /&gt;
  
   &lt;/form&gt;
  </code></pre>
  
  <p>Here is the PHP script - up.php</p>
  
  <pre><code>$file_name = $HTTP_POST_FILES['ufile']['name'];
  $random_digit=rand(0000,9999);
  $new_file_name=$random_digit.".zip";
  mkdir($random_digit, 0777, true);
  
  $path= $random_digit.'/'.$new_file_name;
  if($ufile !=none)
   {
      if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
   {
   echo "The upload is successful&lt;BR/&gt;"; 
   echo "File Renamed to: ".$new_file_name." for processing.&lt;BR/&gt;"; 
   echo "File Size :".$HTTP_POST_FILES['ufile']['size']."&lt;BR/&gt;"; 
   echo "&lt;strong&gt;&lt;a style='color:#6A8DBC; text-decoration:none' href='".$link_address."'&gt;Proceed to the next phase of the importation of data to the system&lt;/a&gt;&lt;/strong&gt;&lt;/br&gt;";
    }
   else
    {
     echo "Error";
     }
   }
  
    $zip = new ZipArchive;
    $res = $zip-&gt;open($new_file_name);
    if ($res === TRUE) {
       $zip-&gt;extractTo($random_digit.'/');
       $zip-&gt;close();
       echo 'extraction successful';
       } else {
       echo 'extraction error';
       }
  </code></pre>
  
  <p>Is it the mode of the folder which prevents extraction? As far as I can see, there is no syntax error.</p>