Can not upload file successful

Now when I use dthmlxVault in my project,I can not upload file successfully,now i whill describe the question next:
in my xhtml page i used these script:

the code in UploadHandler.java is:
public void UploadHandler(){
System.out.print(“in the method of UploadHandler()!!!”);
String uploadFolder = “c:\upload\”;
HttpServletResponse response = FacesContextUtil.getResponse();
HttpServletRequest request = FacesContextUtil.getRequest();
HttpSession session = FacesContextUtil.getSession();
// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(request);
if (!isMultipart) {
PrintWriter out;
try {
out = response.getWriter();
out.println (“Use multipart form to upload a file!”);
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {

	String fileId = request.getParameter("sessionId").toString().trim();
	        
	// Create a new file upload handler
	FileItemFactory factory = new ProgressMonitorFileItemFactory(request, fileId);
	ServletFileUpload upload = new ServletFileUpload(factory);

	// Parse the request
	List items;
	try {
		items = upload.parseRequest(request);
		// Process the uploaded items
		Iterator iter = items.iterator();
		while (iter.hasNext()) {
		    FileItem item = (FileItem) iter.next();
		    if (item.isFormField()) {
		        //processFormField
		    } else {
		        //processUploadedFile
				String fieldName = item.getFieldName();
				String fileName = item.getName();
				int i2 = fileName.lastIndexOf("\\");
				if(i2>-1) fileName = fileName.substring(i2+1);
				File dirs = new File(uploadFolder);
				//dirs.mkdirs();

				File uploadedFile = new File(dirs,fileName);
				item.write(uploadedFile);
				session.removeAttribute("FileUpload.Progress."+fileId);
				session.setAttribute("FileUpload.Progress."+fileId,"-1");
		    }
		 }
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	

	}  
    FacesContextUtil.getFacesContext().responseComplete();

}
so i found the problem after debugging is that: when the program entered the method of UploadHandler the size of List items is 0 and the while (iter.hasNext()) ) is false,but I do not why and how to resolve the problems ,so i hope you can give me some help.I must tell you that my project is a JSF project!thanks!!

I believe, JSF does not pass the uploaded item to your code, you need to tune them some how.
What versoin of JSF are you using, what server, please give me all the details so i can find the solution for you.

Same problem here with the Java version

Using CATALINA_BASE: D:\apache-tomcat-5.5.15
Using CATALINA_HOME: D:\apache-tomcat-5.5.15
Using CATALINA_TMPDIR: D:\apache-tomcat-5.5.15\temp
Using JRE_HOME: D:\Program Files\Java\jdk1.5.0_09

fileId [E8BD0E440A1696CFB921BFDF5D3CEAD0]
customerId [PS104]
country [UK]
UPLOAD_IDENTIFIER E8BD0E440A1696CFB921BFDF5D3CEAD0
country UK
customerId PS104
xMAX_FILE_SIZE 943718400
userfile file1
sessionId E8BD0E440A1696CFB921BFDF5D3CEAD0
fileName applications.ico
factory [com.scand.fileupload.ProgressMonitorFileItemFactory@183d59c]
upload [org.apache.commons.fileupload.servlet.ServletFileUpload@3cfaab]
items.size 0


Upload Control
<script language="JavaScript" type="text/javascript" src="scripts/dhtmlxVault/codebase/dhtmlxvault.js"></script>

<script language="JavaScript" type="text/javascript">
    var vault = null;
    function doOnLoad() {
        vault = new dhtmlXVaultObject();
        vault.setImagePath("scripts/dhtmlxVault/codebase/imgs/");
        vault.setServerHandlers("UploadHandler", "GetInfoHandler", "GetIdHandler");
        vault.create("vault1");

        vault.setFormField("customerId", "PS104");
        vault.setFormField("country", "UK");
}
</script>

<style>
body{font-family:arial;font-size:12px}
h1 {cursor:pointer;font-size:16px;margin-left:10px;line-height:10px}
xmp {color:green;font-size:12px;margin:0px;font-family:courier;background-color:#e6e6fa;padding:2px}
.hdr{
	background-color:lightgrey;
	margin-bottom:10px;
	padding-left:10px;
}
</style>
DHTMLX Vault sample
<h1>Add More Form Fields</h1>
<p>You can place this JavaScript file upload anywhere on your web page, attaching it 
to any div object.<br>
Set up server handlers for your server type.<br><br>
    Click "Add" button to select files.
</p>

<div id="vault1">
</div>

public class UploadHandler extends HttpServlet implements Servlet {

String uploadFolder = "d:\\temp\\reports\\upload\\";

protected void doGet(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {
    doPost( request, response);
}

protected void doPost(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {

// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(request);
HttpSession session = request.getSession();

    if (!isMultipart) {

        System.out.println("Use multipart form to upload a file!");

    } else {

        String fileId = request.getParameter("sessionId").toString().trim();

        System.out.println ("fileId [" + fileId + "]");

        for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
            String n = (String)e.nextElement();
            System.out.println (n + " " + request.getParameter(n));
        }

// Create a new file upload handler
FileItemFactory factory = new ProgressMonitorFileItemFactory(request, fileId);
System.out.println(“factory [” + factory + “]”);
ServletFileUpload upload = new ServletFileUpload(factory);
System.out.println(“upload [” + upload + “]”);
try {
// Parse the request
List items = upload.parseRequest(request);
System.out.println ("items.size " + items.size());

// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
System.out.println ("item " + item.getName());

                if (item.isFormField()) {
                    //processFormField
                } else {
                    //processUploadedFile
                    String fieldName = item.getFieldName();
                    String fileName = item.getName();
                    int i2 = fileName.lastIndexOf("\\");
                    if (i2 > -1) {
                        fileName = fileName.substring(i2 + 1);
                    }
                    File dirs = new File(uploadFolder);
                    //dirs.mkdirs();

                    File uploadedFile = new File(dirs, fileName);
                    item.write(uploadedFile);

                    session.setAttribute("FileUpload.Progress." + fileId, "-1");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

}

OK found the problem.
It is due to incompatibility libraries.

Worked when I used commons-fileupload-1.2.2 and commons-io-2.0.1