I gave you a snippet below that works for me, might help ya.
Eric D. Lemle Senior Programmer / Analyst Intermountain Health Care 36 South State Street, Suite 1100 Salt Lake City, Utah 84111 United States of America (USA) (801) 442-3688 -- e-mail: [EMAIL PROTECTED] >>> [EMAIL PROTECTED] 2/22/2005 1:37:34 PM >>> Hi, Is there anybody with "out of memory" problems using FormFile in Struts 1.2.4? I've just migrated from 1.1 and I didn't change anything related to file attachment logic. But the actions that use "html:form" tag-lib with enctype="multipart/..." and file attachment logic are now taking about 40MB of RAM off in each request...after two or three clicks the garbage works or I receive "out of memory". Is there any changes in the Struts "FormFile" approach after 1.1? Thanks in advance! Paulo Alvim --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] public ActionForward process(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { FormFile formFile; byte[] contents; try { formFile=(FormFile)myForm.get("attachment"+tag); // ---------- The preferred method ------------- contents=new byte[formFile.getFileSize()]; BufferedInputStream bis=new BufferedInputStream(formFile.getInputStream()); int length=bis.read(contents,0,formFile.getFileSize()); bis.close(); if (length==contents.length && contents != null && formFile.getFileSize() > 0) { myForm.set("file_nm"+tag, formFile.getFileName()); myForm.set("mime_type_txt"+tag, formFile.getContentType()); myForm.set("file_contents_bin"+tag, contents); } formFile.destroy(); } catch (Exception e) { e.printStackTrace(); } finally { } return mapping.findForward("login"); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]