title: Create a PHP contact form with multiple image upload
body: <p>I need to create an html contact form which collects some data and uploads 8 images through a PHP script</p>
  
  <p>This is my HTML: </p>
  
  <pre><code>&lt;form action="formmail.php" onsubmit="return controlloform()" id="form" name="form" method="POST" enctype="multipart/form-data"&gt;
      &lt;input name="email" id="email" placeholder="Email address" type="text" value="" maxlength="40"&gt;
      &lt;input name="tel" id="tel" type="text" placeholder="Order number" value="" maxlength="20"&gt;
      &lt;textarea name="msg" placeholder="Message" value="" maxlength="300"&gt;&lt;/textarea&gt;
      Upload a photo:
      &lt;p&gt;
          &lt;p&gt;
              &lt;input name="file" id="file" class="button" type="file" value=""&gt;
              &lt;p&gt;
  
                  &lt;p&gt;
                      &lt;td colspan="2"&gt;
                          &lt;input type="submit" class="button" value="Submit" /&gt;
                      &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I don't know how to create the upload script, what I need to do is uploading 2 blocks of 4 images, check the extension of the file (only jpg and png allowed) and the size (max 500 kb for image).</p>
  
  <p>I've already found some upload scripts (not 100% suitable for what I need) but I don't know how to include the upload part into the rest of the code</p>
  
  <p>If anyone could help me would be great</p>
  
  <p>Thanks a lot</p>