title: Storing multiple files uploaded in different folders
body: <p>I'm able to call out all my multiple files in an array and it can be able to be stored in a specific folder for eg. "./documents/". </p>
  
  <pre><code>Code for my form:
  &lt;form id="Student" name="Student" method="post" action="uploaded.php" enctype="multipart/form-data"&gt;
  &lt;input name="upload[]" id="Assign" type="file"/&gt;
  &lt;input name="upload[]" id="Testpapers" type="file"/&gt;
  &lt;input name="upload[]" id="others" type="file"/&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
  
  Code for uploaded.php:
  $number_of_uploaded_files = 0;
  for ($i = 0; $i &lt; count($_FILES['upload']['name']); $i++) 
  {
   if ($_FILES['upload']['name'][$i] != '') 
  {
      $dir = "documents/";
      $number_of_uploaded_files++;
      $uploaded_files[] = $_FILES['upload']['name'][$i];
      move_uploaded_file($_FILES['upload']['tmp_name'][$i], $dir. $_FILES['upload']['name'][$i])          
  
      }
  </code></pre>
  
  <p>Is it possible to store them in different folders respectively? Like store them inside "documents/assign" then "documents/testpapers". I can't think of an idea to detect array index belongs to assign or testpapers, others.</p>