add validation of file type for uploading and corressponding test.

review ok