Hi, I'm a newbie in the world of struts programming and I need help urgently. I'm doing a file uploading module and thus far I've done all the nessesary coding and included all nessesary functions. My problem is when I test the code, the iterator (i) does not have any values, i.hasnext() always return false although when I check the contentLength of the request it always contain the file value. I'm suspecting that the HttpServletRequest does not pass the appropriate value when submitting. I've also added the line into my jsp files:
<html:form action="vims0024_insert" focus="uploadFile" enctype="multipart/form-data"> I'm currently using WSAD 4.0.5 and using the commons-fileupload.jar. I really appreciate it if anyone could help me in this. Million thanx Regards, Alvin public boolean upload(javax.servlet.http.HttpServletRequest req) { try { System.out.println("length = " + req.getContentLength()); if ( req.getContentLength() > 10000000 ) { System.out.println("ERROR: File size too big"); } FileUpload fu = new FileUpload(); fu.setSizeMax(10000000); fu.setSizeThreshold(10240); fu.setRepositoryPath("../webapps/tmpAG"); List fileItems = fu.parseRequest(req); Iterator i = fileItems.iterator(); while (i.hasNext()) { System.out.println("in while loop"); FileItem fi = (FileItem)i.next(); String fieldName = fi.getFieldName(); if (fieldName.equals("uploadFile") || fieldName.equals("uploadFile")) { String name = fi.getName(); System.out.println("fileName = " + name); FileOutputStream fileOutputStream = new FileOutputStream("../webapps/agFiles/" + name); fileOutputStream.write(fi.get()); fileOutputStream.close(); fi.delete(); fi = null; } } fu = null; } catch (FileUploadException e) { System.out.println("upload FAIL: " + e); return false; } catch (Exception e) { System.out.println("upload FAIL: Other exception: " + e); return false; } return true; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]