Wordpress: PHP multiple file upload
<p>I have a <strong>HTML</strong> form for a file upload, which sends the uploaded file to the backend directory of my wordpress site. How can I enable multiple file uploads? I tried simply adding multiple="multiple" to my file upload form (which allowed me to select multiple files) but in the directory only one file is uploaded. Here is the form: </p>

<pre><code>&lt;form action="http://www.aerex.co.uk/php-upload/" method="post" enctype="multipart/form-data"&gt;
    Select image to upload:
    &lt;input type="file" name="fileToUpload" id="fileToUpload" multiple="multiple"&gt;
    &lt;input type="submit" value="Upload Image" name="submit"&gt;
&lt;/form&gt;
</code></pre>

<p>The PHP for the action page:</p>

<pre><code>&lt;?php
    $target_dir = $_SERVER['DOCUMENT_ROOT'] . '/wp-content/uploads/';
    $target_file = $target_dir . '/' . basename($_FILES["fileToUpload"]["name"]);
    move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);
    $uploadOk = 1;
    $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
    // Check if image file is a actual image or fake image
    if(isset($_POST["submit"])) {
         $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
          if($check !== false) {
            echo "File is an image - " . $check["mime"] . ".";
            $uploadOk = 1;
            } else {
             echo "File is not an image.";
             $uploadOk = 0;
      }
    }
?&gt;
</code></pre>