You need to strip the extension with something like this:
$strip = explode(".", $fileName); // Split file name into an array using the dot
$fileExt = end($strip); // Now target the last array element to get the file extension
Then use strtoupper like:
$fileExt = strtoupper($fileExt);
In theory this would work though I haven't tried it.