title: IE won't allow users jpg's to upload via PHP - other image extensions work
body: <p>I'm running an image upload script for users where I have allowed png, jpg, jpeg and gif extensions.</p>
  
  <p>When using IE 7-9, users can only successfully submit png's or gif's. IE users can't seem to get a jpg uploading.</p>
  
  <p>I understand about pjpeg and have modified code accordingly due to this IE issue, however, the issue still occurs. Users on IE cannot upload a jpg but other extensions work just fine.</p>
  
  <p>Any hints? Thank you!</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>            $filename = basename($_FILES['photo']['name']);
              $ext = substr($filename, strrpos($filename, '.') + 1);
  
              //Edit as per comments below
              $ext = strtolower($ext);
  
              //Check if the file is a JPG, JPEG, GIF or PNG image and it's size is less than 5Mb
              $allowedExts = array('jpg', 'jpeg', 'gif', 'png');
              if ( (in_array($ext, $allowedExts)) &amp;&amp;
              ($_FILES["photo"]["type"] == "image/jpeg") ||
              ($_FILES["photo"]["type"] == "image/png") ||
              //Edit as per comments below
              ($_FILES["photo"]["type"] == "image/x-png") ||
              ($_FILES["photo"]["type"] == "image/gif") ||
              ($_FILES["photo"]["type"] == "image/pjpeg")
              &amp;&amp; ($_FILES["photo"]["size"] &lt;= 5242880) ){
  
              //Name it and determine the path to which we want to save this file
              $newname = str_replace( ' ', '_', trim( strip_tags( $_POST['first-name'].'_'.$_POST['last-name'] ) ) ) . '_' . $formKey-&gt;generateKey() . '_' . time() . '.jpg';
              ...  
  </code></pre>
  
  <p><strong>FORM</strong></p>
  
  <pre><code>&lt;form id="submit-photo" action="index.php?p=uploader" enctype="multipart/form-data" method="POST"&gt;
          &lt;?php if(!isset($_SESSION['flash_message']) &amp;&amp; isset($_SESSION['recent_field']) ) unset($_SESSION['recent_field']); ?&gt;
          &lt;?php $formKey-&gt;outputKey(); ?&gt;
          &lt;input type="hidden" name="MAX_FILE_SIZE" value="5242880" /&gt;
                  &lt;div id="upload-photo"&gt;
                          &lt;input type="file" name="photo" id="photo" /&gt;
                  &lt;/div&gt;
                  ...
  </code></pre>