Try theIn below code -we find out mime type of uploaded file. Then using switch case we check mime type of uploaded file is application/pdf or not.
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $_FILES['file']['tmp_name']);
$ok = false;
switch ($mime) {
case 'application/pdf';
$ok = true;
default:
die("Unknown/not permitted file type");
}