title: user can submit data with photo.But here i can't check the image content.how to check here with mime
body: <pre><code>    &lt;?php
  $allowedExts = array("gif", "jpeg", "jpg", "png");
  $temp = explode(".", $_FILES["file"]["name"]);
  $extension = end($temp);
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/jpg")
  || ($_FILES["file"]["type"] == "image/pjpeg")
  || ($_FILES["file"]["type"] == "image/x-png")
  || ($_FILES["file"]["type"] == "image/png"))
  &amp;&amp; ($_FILES["file"]["size"] &lt; 2000000)
  &amp;&amp; in_array($extension, $allowedExts))  
  {
  if ($_FILES["file"]["error"] &gt; 0) 
  {
  echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br&gt;";
  } 
  else 
      {
      $imagepath = "propertyimages/".(rand()) . $_FILES["file"]["name"];
      move_uploaded_file($_FILES["file"]["tmp_name"], $imagepath);
  
      $db = pg_connect("host=localhost port=5432 dbname=ohms user=postgres password=padmin");
       $s="select dcode from dept where dname='$_POST[select]'";   
        $s1=pg_query($s);  
      $row=pg_fetch_array($s1);
       $row[0]; 
      $r = pg_fetch_row($s1);
      $query = "INSERT INTO nsr VALUES ('$_POST[text1]','$_POST[text2]',  
      '$_POST[textarea]','$row[0]','$_POST[textfield3]', '$_POST[text5]','$_POST[text6]','$_POST[text7]','$_POST[text8]','$_POST[textfield]','$_POST[text10]','$_POST[ref_phno]','$d','".$imagepath."')";  
      $result = pg_query($query);
  }}
  </code></pre>
  
  <p><strong>tish is the code of a registration  page.user cane submit data with image.here user can submit various image extension .but want insert thost image whose content are image..not a txt with .jpg extension how to do this.please help</strong></p>