title: OOP based syntax to get file’s MIME type
body: <p>I would like to allow users, to upload files to my server, i don't really know the error with this syntax</p>
  
  <p>//EDITED</p>
  
  <pre><code>$temp = "file.pdf";
  $fileInfo = new finfo;
  $getType = $fileInfo-&gt;file($temp, FILEINFO_MIME);
  
  $fileExt = array( 'jpg' , 'jpeg' , 'gif' , 'png' , 'zip' , 'rar' , 'pdf' , 'doc' , 'rtf' , 'xls' , 'ppt' , 'odt' , 'ods' );
  $ext = strtolower(  substr(  strrchr($temp, '.')  ,1)  );
  if(!in_array($ext, $fileExt)) {
      echo "Ext not allowed"
  }else {
      if ($getType == "application/pdf" || $getType == "image/png") {
          echo "Ok " .$getType;
      }else {
          echo "No " .$getType;
      }
  }
  </code></pre>
  
  <p>Output: No application/pdf;</p>
  
  <p>Any idea ?</p>