Add filename validation to uploads.

There's a security flaw that allows users to upload files ending in a period and bypass the file extension blacklisting.
The file can then be executed on some systems as though it was named with the correct extension.
For example "example.php." could be uploaded and then run on the server as /example.php