title: Uploading multiple images with one input field
body: <p>i have created a photography website with an admin page that uploads photos to different categories in a mysql table. This much works, but i can only upload one file at a time and i'd like to be able to select multiple images.</p>
  
  <p>Here's the form</p>
  
  <pre><code>&lt;form action="index.php" enctype="multipart/form-data" name="myForm" id="myForm" method="post"&gt;
  
      &lt;select name="category" id="category"&gt;
          &lt;option value="Nature"&gt;Nature&lt;/option&gt;
          &lt;option value="People"&gt;People&lt;/option&gt;
          &lt;option value="Abstract"&gt;Abstract&lt;/option&gt;
      &lt;/select&gt;
  
      &lt;input type="file" name="fileField" id="fileField" /&gt;
  
      &lt;input type="submit" name="submit" id="submit" value="Add Images" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>And here's the php for parsing the form</p>
  
  <pre><code>if (isset($_POST['submit'])) {
  
  $category = mysql_real_escape_string($_POST['category']);
  // Add this product into the database now
  $sql = mysql_query("INSERT INTO images (category, date_added) 
      VALUES('$category',now())") or die (mysql_error());
  
  
   $pid = mysql_insert_id();
  // Place image in the folder 
  $newname = "$pid.jpg";
  move_uploaded_file( $_FILES['fileField']['tmp_name'], "../photos/$newname");
  header("location: thumbnail_generator.php"); 
  exit();
  }
  </code></pre>
  
  <p>I looked into the html5 file input method, and as far as i can tell, i can change the input as folllows:</p>
  
  <pre><code>&lt;input type="file" name="fileField[]" id="fileField" multiple="multiple"/&gt;
  </code></pre>
  
  <p>This allows me to select multiple files on the site, but i can't figure out how to implement this into my php. Any help would be much appreciated.</p>