title: php multiple image upload and display each image
body: <p>i'm struggle with some multiple image upload script.</p>
  
  <p>what i implement to do is , upload multiple image then save each image saved path to variable </p>
  
  <p>so i use later for display .</p>
  
  <p>but when i run script i only can save first upload image path value.</p>
  
  <pre><code>&lt;form action="" method="post" enctype="multipart/form-data"&gt;
  &lt;p&gt;
  &lt;input type="file" name="pictures[]" /&gt;&lt;br&gt;
  &lt;input type="file" name="pictures[]" /&gt;&lt;br&gt;
  &lt;input type="file" name="pictures[]" /&gt;&lt;br&gt;
  &lt;input type="file" name="pictures[]" /&gt;&lt;br&gt;
  &lt;input type="submit" value="Send" /&gt;
  &lt;/p&gt;
  &lt;/form&gt;
  
  
  &lt;?php
  foreach ($_FILES["pictures"]["error"] as $key =&gt; $error) {
      if ($error == UPLOAD_ERR_OK) {
          $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
          $name = $_FILES["pictures"]["name"][$key];
          $ext = substr(strrchr($name, "."), 1);
          $randName = md5(rand() * time());
          $pathimg = "images/$randName.$ext";
          move_uploaded_file($tmp_name, $pathimg );
          echo '&lt;img src="'.$pathimg.'"; &gt;' ;
  
  
      }
  }
  ?&gt;
  </code></pre>
  
  <p>this is upload path '' </p>
  
  <p>for example if i upload 3 images then i want to save this 3 image uploaded path to variable each. so each variable will be $A, $B, $C</p>
  
  <p>or if i upload 4 images i also want to this 4 image path to variable each then use for later</p>
  
  <p>please enlighten me! thanks</p>