title: How to read header of a file uploaded in PHP?
body: <p>Can we read the header information of a file in PHP to determine the type of file uploaded?.</p>
  
  <p>I don't want to rely on <code>$_FILES['control_name_from_client']['type'].</code> As we know that this property determines the file type by reading the extension of the file uploaded.</p>
  
  <p>What if the user renames, say <strong>test.jpg</strong> -> <strong>test.xls</strong>. In that case, <code>$_FILES['control_name_from_client']['type']</code> will show the type as <strong><em>application/vnd.ms-excel</em></strong> instead of <strong><em>image/jpeg</em></strong>. It is but natural this can create problems if a code has to be executed which reads the XLS file to fetch data for some processing.</p>
  
  <p>Any suggestions please?</p>