i believe ciber or wilik (or whoever it was) has already implemented the same coding in the page where you can edit your profile, just below the default avatar selection.

i haven't tried it out myself but i trust that it works.