What you are finding with the getAttribute function is merely a string.
The actual file type and if it exists at all are not found at this point.
However, in your example, you now have the string that contains the file you are looking for and can use java to substring off the last part filename.
String type;
String attribute = driver.findElement(webdriver.By.id('hplogo')).getAttribute('outerHTML');
int dotLocation = attribute.lastIndexOf(".");
if(dotLocation != -1 && dotLocation != attribute.length -1){
type = attribute.substring(dotLocation + 1, attribute.length());
} else {
type = "Unknown";
}