title: php imagecreatefromjpeg not working
body: <p>I am new to PHP, so this might be an easy one.
  I just want to display an image once it is uploaded and sent to the script by POST. But I am not able to see the image.</p>
  
  <p>Please find the code below:
  Name of the php file is test.php</p>
  
  <pre><code>&lt;?php
  
  if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  
      if(isset($_FILES['photo'])
      &amp;&amp; is_uploaded_file($_FILES['photo']['tmp_name'])
      &amp;&amp; $_FILES['photo']['error'] == UPLOAD_ERR_OK){
  
          if ($_FILES['photo']['type']=='image/jpeg') {
  
              $tmp_img = $_FILES['photo']['tmp_name'];
              $image = imagecreatefromjpeg($tmp_img);
              header('Content-Type: image/jpeg');
              imagejpeg($image,'',90);
              imagedestroy($image); 
  
          }else{
              echo "Uploaded file was not JPEG","&lt;/br&gt;";
          }   
      }else{
          echo "No file uploaded","&lt;/br&gt;";
  
      }
  }else{
      ?&gt;
      &lt;form action="test.php" method="post" enctype="multipart/form-data"&gt;
          &lt;label for="photo"&gt;Photo : &lt;/label&gt;
          &lt;input type="file" name="photo"/&gt;
          &lt;input type="submit" value="Upload a JPEG photo"/&gt;
      &lt;/form&gt;
  
  &lt;?php } ?&gt;
  </code></pre>