websurfer 0 Junior Poster in Training

Hello, all:

I have this single-file upload script which works great (it's a bit log cause it creates thumbs, unique ID's,e tc), but I am trying to modify it to make it do MULTIPLE files. I figured best way was to apply a foreach loop to it, but havent been able how to figure out how to integrate that.
Can anybody please help!...

See code here:

<table width="300" border="1" align="center" cellpadding="20" cellspacing="0">
  <tr>
    <td><form action="<?php echo $_server['php-self'];  ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
      <p>
        <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" />
        <br />
      </p>
      <button name="submit" type="submit" class="submitButton">Upload/Resize Image</button>
    </form></td>
  </tr>
  <tr>
    <td height="112" align="center" valign="top"><?php
        if(isset($_POST['submit'])){
		
		
          if (isset ($_FILES['new_image'])){
              $imagename = $_FILES['new_image']['name'];
              $source = $_FILES['new_image']['tmp_name'];
			  
			  
			   $imagename = rand (). ".jpg" ;
			  
			  
              $target = "images/".$imagename;
              move_uploaded_file($source, $target);
              
              $imagepath = $imagename;
              $save = "images/" . $imagepath; //This is the new file you saving
              $file = "images/" . $imagepath; //This is the original file

              list($width, $height) = getimagesize($file) ; 
                                                         
              $modwidth = 750; 
                                                         
              $diff = $width / $modwidth;
                                                        
              $modheight = $height / $diff; 
              $tn = imagecreatetruecolor($modwidth, $modheight) ; 
              $image = imagecreatefromjpeg($file) ; 
              imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 
                                                        
              imagejpeg($tn, $save, 100) ; 

              $save = "images/sml_" . $imagepath; //This is the new file you saving
              $file = "images/" . $imagepath; //This is the original file

              list($width, $height) = getimagesize($file) ; 
                                                         
              $modwidth = 110; 
                                                         
              $diff = $width / $modwidth;
                                                        
              $modheight = $height / $diff; 
              $tn = imagecreatetruecolor($modwidth, $modheight) ; 
              $image = imagecreatefromjpeg($file) ; 
              imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 
                                                        
              imagejpeg($tn, $save, 100) ; 
			 
            //(this echo line disabled for now) echo "Large image: <img src='images/".$imagepath."'><br>"; 
            echo "<p>Picture uploaded:<br /></p> <img src='images/sml_".$imagepath."'>"; 
			
        
          }
        }
		
		?>
        
        
        
        
        
        
        &nbsp;</td>
  </tr>
</table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.