less code in uploadimage