* fix upload file type check * make the function simple and added tests * Update comment as per @silverwind