This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Has anybody FileUpload.class containing setSizeMax() method?
yoman sharma
Greenhorn
Joined: Feb 10, 2005
Posts: 13
posted
0
Hi actually my servlet code uses FileUpload.setSizeMax() method. But the class file which i have don't posses this method so i am getting the following message everytime
-------------------------------------------------------- THe servlet code which causes this exception is as follows in which setSizeMax() is called with the help of FileUpload reference. -------------------------------------------------------
response.setContentType("text/html"); PrintWriter out = response.getWriter();
out.println("<html>"); out.print("File upload success. <a href=\"/jspbook/files/"); out.print("\">Click here to browse through all uploaded "); out.println("files.</a><br>");
ServletContext sc = getServletContext(); String path = sc.getRealPath("/files"); org.apache.commons.fileupload.FileUpload fu = new org.apache.commons.fileupload.FileUpload(); fu.setSizeMax(-1); fu.setRepositoryPath(path); try { List l = fu.parseRequest(request); Iterator i = l.iterator(); while (i.hasNext()) { FileItem fi = (FileItem)i.next(); // trim out full path info if it is included String filename = fi.getName(); int slash = filename.lastIndexOf("\\"); if (slash != -1) { filename = filename.substring(slash + 1); } // write the file to the 'files' directory fi.write(path+"/"+filename); } } catch (Exception e) { throw new ServletException(e); }
--------------------------- So please can anybody send me the class file of FileUpload which contains this setSizeMax() method or suggest me a method to resolve this.