I use this pre-built Flash + JavaScript solution. It costs money, but it works great. It will record, encode to MP3 and upload via PHP: http://recorder.denniehoopingarner.com/
Here is a free example that Flash will use to encode OGG: http://labs.byhook.com/2011/02/22/ogg-vorbis-encoder-decoder-for-flash/
I sat next to some Google programmers in a recent hackathon in SF, who shared with me that Chrome will enable the default audio recording flag starting in April 2013, which technically makes recording in pure JS possible, but I have not seen a solution for encoding and uploading to the server. Good luck
source share