notes/HTML5 Upload Multiple Files-38PDYQkC.php.html
<?php
if(isset($_POST['submit'])){
  if(count($_FILES['upload']['name']) > 0){
    //Loop through each file
    for($i=0; $i<count($_FILES['upload']['name']); $i++) {
      //Get the temp file path
      $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
      //Make sure we have a filepath
      if($tmpFilePath != ""){

        //save the filename
        $shortname = $_FILES['upload']['name'][$i];

        //save the url and the file
        $filePath = "uploaded/" . date('d-m-Y-H-i-s').'-'.$_FILES['upload']['name'][$i];

        //Upload the file into the temp dir
        if(move_uploaded_file($tmpFilePath, $filePath)) {
          $files[] = $shortname;
          //insert into db 
          //use $shortname for the filename
          //use $filePath for the relative url to the file

        }
      }
    }
  }

  //show success message
  echo "<h1>Uploaded:</h1>";    
  if(is_array($files)){
    echo "<ul>";
    foreach($files as $file){
      echo "<li>$file</li>";
    }
    echo "</ul>";
  }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Upload Files</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
  <form action="" enctype="multipart/form-data" method="post">

    <div class="form-group">
      <label for='upload'>Add Attachments:</label>
      <input class="btn btn-default btn-block" id='upload' name="upload[]" type="file" multiple="multiple" />
    </div>

    <p><button type="submit" class="btn btn-primary btn-block" name="submit" value="Submit">Upload</button></p>

  </form>

</body>
</html>

syntax highlighted by Code2HTML, v. 0.9.1