Added check for the existence of extension

If I try to attached a file without an extension, I get an error saying that the key 'extension' is not in exist, and this is understandable, since the key is not created when the extension is not exist.

Additional info:
http://www.php.net/manual/en/function.pathinfo.php
"If the path does not have an extension, no extension element will be returned (see second example below)."