title: Upload multiple images to a folder with each input having a different name
body: <p>I am trying to upload multiple images to a folder using PHP using this tutorial I managed:</p>
  
  <p>In the PHP form</p>
  
  <pre><code>&lt;?php
    $success = 0;
    $fail = 0;
    $uploaddir = 'uploads/';
    for ($i=0;$i&lt;4;$i++)
    {
     if($_FILES['userfile']['name'][$i])
     {
      $uploadfile = $uploaddir . basename($_FILES['userfile']['name'][$i]);
      $ext = strtolower(substr($uploadfile,strlen($uploadfile)-3,3));
      if (preg_match("/(jpg|gif|png|bmp)/",$ext))
      {
       if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $uploadfile)) 
       {
        $success++;
       } 
       else 
       {
       echo "Error Uploading the file. Retry after sometime.\n";
       $fail++;
       }
      }
      else
      {
       $fail++;
      }
     }
    }
    echo "&lt;br&gt; Number of files Uploaded:".$success;
    echo "&lt;br&gt; Number of files Failed:".$fail;
  ?&gt;
  </code></pre>
  
  <p>In the HTML form</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="upload.php" method="post"&gt;
  Image1: &lt;input name="userfile[]" type="file" /&gt;&lt;br /&gt;
  Image2: &lt;input name="userfile[]" type="file" /&gt;&lt;br /&gt;
  Image3: &lt;input name="userfile[]" type="file" /&gt;&lt;br /&gt;
  Image4: &lt;input name="userfile[]" type="file" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>As you can see in the HTML form the input name is userfile[] for all of them. Now in my HTML for the input names are as follows: picture01, picture02, picture 03, etc...</p>
  
  <p>How can I modify the <strong>PHP code</strong> to have my input names {: picture01, picture02, picture 03} rather than userfile[].</p>
  
  <p>Thanks.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I want the above to fit in my HTML Form</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="upload.php" method="post"&gt;
      Picture 01&lt;input id="picture01"  name="picture01" type="file" &gt;&lt;br /&gt;
      Picture 02&lt;input id="picture02"  name="picture02" type="file" &gt;&lt;br /&gt;
     Picture 03&lt;input id="picture03"  name="picture03" type="file" &gt;&lt;br /&gt;
      Picture 04&lt;input id="picture04"  name="picture04" type="file" &gt;&lt;br /&gt;
      &lt;input type="submit" value="Upload" /&gt;
      &lt;/form&gt;
  </code></pre>