Hello,
To check for a certain file extension, you can use something like...
$filename = "somefile.txt";
$ext = substr($filename, strrpos(".", $filename));
I may have the order of arguments mixed up for these functions. The idea behind this is to find the last occurrence of the "." character and return everything to the right of it as the files extension. Not tested out, but not too involved, so if this exact code doesn't work out, shift a few things around.