HTML5 comes with a great feature which is the ability to upload files using the XMLHttpRequest version 2.
Modern Gecko and WebKit browsers include a wonderful object FormData
that allows combining both simple and complex form data (text and files)
in the Ajax request object.
Let's show you how to do this: http://www.technicaladvices.com/2011/12/10/ajax-file-upload-to-a-java-servlet-in-html5/