modify file upload function, identify filetype through filename extension