title: PHP Photo/File Upload Issues
body: <p>Been looking around as i'm having a few issues with PHP file upload! I'm trying to upload a photo or three to a database (admin_images) if the user wants to or show the photo that's already stored in the db. I'm having some issues, below is my code I currently have, any advice is welcome. </p>
  
  <pre><code> require_once 'connect/config.php'; 
   require_once 'connect/opendb.php';
   require_once 'connect/magic.quotes.php';
  
   $home_query = "SELECT * FROM admin"; 
  $home_rt = mysql_query($home_query); 
  $home_row = mysql_fetch_assoc($home_rt);
  
   if(isset($_POST['submit']))  {      $HomeTitle = check_input($_POST['HomeTitle']);      $HomeBio = check_input($_POST['HomeBio']);
  
      $home_query = mysql_query("UPDATE admin SET HomeTitle = '".$HomeTitle."', HomeBio = '".$HomeBio."' WHERE ID = 1");  
  
  
              foreach ($_FILES['file']['name'] as $f =&gt; $name)    {
                  $name = strtolower($name);
                  $allowedExts = array("gif", "jpeg", "jpg", "png");      $temp = explode(".", $name);        $extension = end($temp);
                  if(in_array($extension, $allowedExts))      {           if($_FILES['file']['size'][$f] &lt; 2000000)           {
                  $uniqid = uniqid();
  
                  move_uploaded_file($_FILES["file"]["tmp_name"][$f], "upload/" . $uniqid  . "." . $extension);
  
                  mysql_query("INSERT INTO admin_images (id, HomeImage1, HomeImage2, HomeImage3) VALUES (".$last_id.", '".$uniqid .".".$extension."')");
                          }           else            {
                          }       }       else        {
                  }   }   header("Location: home1.php");
  
  }  require_once 'connect/closedb.php'; ?
  </code></pre>
  
  <p>In the PHP further down the page I have included:</p>
  
  <pre><code>input type="file" name="files[]" multiple
  </code></pre>
  
  <p>Apologies if I'm being unclear. 
  Thanks in advance.</p>