upload_file(): Use basename when deriving the name from a file object