It is generally a bad habit to check file type using the extension. I can easily create a text file and rename it .jpg According to this code it would suddenly become an actual image. Or even more evil: I might exploit some bug in webbrowsers by creating a fake jpg that actually executes some code.
Besides that, I might name my jpeg files JPEG, jPG, jpG, JPeg or any other combination you might think of. Then there's also other formats than jpeg. I don't know the rest of your code, but maybe you want someone to allow uploading png or gif images.
If you want to be a little more sure that you actually have an image file, a more sure way to check is using getimagesize. That does require the GD extension though. If that function provides you with output that seems likely to be real you're a whole lot safer using that file as an image. Sure there are cases when you don't care and just want to check for the extension of a file. But I get a feeling this code is supposed to get a little public. A little example:
<?php
$file = $row['dfilepath'];
// where upload_dir is a function that somehow finds
// the absolute path of the upload dir
$path = upload_dir() . DIRECTORY_SEPARATOR . $file;
$valid = array('image/jpeg', 'image/gif', 'image/png');
$info = getimagesize($path);
if($info !== false && in_array($info['mime'], $valid) {
// more likely you'll actually have an image here
// now you might want to print some html here, like:
?><img src="/uploads/<?php print $file; ?>" alt="" /><?php
}
?>