how to validate file upload in drupal
If your are writing your own validation u can use finfo_file from php

http://www.php.net/manual/en/function.finfo-file.php

Example #1 A finfo_file() example 

&lt;?php
  $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
  foreach (glob("*") as $filename) {
    echo finfo_file($finfo, $filename) . "\n";
  }
  finfo_close($finfo);
?&gt;


The above example will output something similar to:


text/html
image/gif
application/vnd.ms-excel