title: Check Upload file type from an array in PHP.
body: <p>How can I check if a file extension and mime type are in an array this is the code I currently have.  </p>
  
  <pre><code>$upload_project_thum = $_FILES['upload_project_thum']['name'];
  $upload_project_thum_ext = substr($upload_project_thum, strrpos($upload_project_thum, '.') + 1);    
  $upload_permitted_types= array('image/jpeg:jpg','image/pjpeg:jpg','image/gif:gif','image/png:png');
  </code></pre>
  
  <p>Then down where i'm checking if the  file is a valid type I have this foreach loop  </p>
  
  <pre><code>foreach ($upload_permitted_types as $image_type) {
          $type = explode(":", $image_type);
              if (($type[0] != $_FILES['upload_project_thum']['type']) &amp;&amp;  ($upload_project_thum_ext != $type[1]) ) {
                  $errmsg_arr[] = 'Please select a jpg, jpeg, gif, or png image to use as the project thumbnail'. $type[1] . " Type: ". $type[0];
                  $errflag = true;
          }  
  </code></pre>
  
  <p>The problem is that if the file type isn't ALL of the types in the array (which is impossible) I get an error. It works to the point where if the upload file is in the array that error message won't trigger.  </p>