Use splitext to find the file's extension.
Limit upload size to 512K.