Use [man]mime_content_type[/man] in most cases, but since .dht files don't have a mimetype, use this function:
function check_extension ($extension) {
if (substr($extension, -3)!="dht")) {
die("Not a valid Gauss data file!");
}
}
As you can see, this is a primitive function. Take the code from it, add some code here and there. You might want to open the file and check if it has a header or something that all Gauss data files should have. (I wouldn't know; I don't know anything about Gauss files.)