modify uploadfile function