REFACTOR: uploading avatar should share code with upload component