Here is what I am doing
var url_action="/temp/SaveConfig";
 var client; 
 var dataString;
 if (window.XMLHttpRequest){ // IE7+, Firefox, Chrome, Opera, Safari
     client=new XMLHttpRequest();
 } else {                    // IE6, IE5
     client=new ActiveXObject("Microsoft.XMLHTTP");
 }
 client.onreadystatechange=function(){
     if(client.readyState==4&&client.status==200)
     {
         alert(client.responseText);
     }
 };
 //dataString=document.getElementById("tfile").value;
 client.open("POST",url_action,true);
 client.setRequestHeader("Content-type", "multipart/form-data"); 
 client.setRequestHeader("Connection", "close");     
 client.send();
But at the server side i get org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
Where am i going wrong?
After reading reply from Aticus Here is what i did and file is getting uploaded.
var form=document.forms["mainForm"];
 form.setAttribute("target","micox-temp");
 form.setAttribute("action",url_action);
 form.setAttribute("method","post");
 form.setAttribute("enctype","multipart/form-data");
 form.setAttribute("encoding","multipart/form-data");
 form.submit();
but now how do i recieve values from servlet to perform some kind of checking apart from JSON?
 
     
     
    