There are a number of ways to upload files. The method used in this example depends on a bit of Flash. This is OK because these days, everyone except the staunchest diehards have Flash on their machines for watching videos online or whatever other purposes arise (and these staunch diehards probably frown at JavaScript anyway).
For this example, you will need to download a copy of the Uploadify
plugin from http://www.uploadify.com/ and extract it into the root of your test server. In my case, I downloaded version 1.6.2. Uploadify has been around for a long time, and is well-regarded.
Ajax-based file uploads used to be tricky. The easiest method was to create a small form and submit it into a hidden iframe, which would then report back to the main application when the file is uploaded. These days, the most popular method is to use a JavaScript bridge into Flash, which does not need the iframe or the form, and can also manage multiple uploads natively.