Move photo uploading logic into APIClient.