I was thinking you could get it with the substr command from the filename. something like:
$extension = substr($filename, -3);
Obviously you would need the filename in a variable, I am not sure how you are going about that but I am sure you can figure that part out 😃
Brad