My action is pasted below. As you will see I never call setMaxFile
(long) in my acdtion. From the stack trace it looks like Struts 
internal classes are doing the call: 
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
(CommonsMultipartRequestHandler.java:219)

These are the 2 lines that do the actual call from 
CommonsMultipartRequestHandler:
  DiskFileUpload upload = new DiskFileUpload();
  upload.setSizeMax((int) getSizeMax(ac));

That is not my code. I have tried both solutions mentioned before and 
they did not help.

I would appreciate any help.

Marwan


MaintainItemForm theForm = (MaintainItemForm) form;


//this line is here for when the input page is upload-utf8.jsp,
//it sets the correct character encoding for the response
String encoding = request.getCharacterEncoding();
if ((encoding != null) && (encoding.equalsIgnoreCase("utf-8")))
{
response.setContentType("text/html; charset=utf-8");
}


//retrieve the text data

//retrieve the file representation
FormFile file = theForm.getMyFile();

//retrieve the file name
String fileName= file.getFileName();

//retrieve the content type
String contentType = file.getContentType();

//boolean writeFile = theForm.getWriteFile();

//retrieve the file size
String size = (file.getFileSize() + " bytes");

String data = null;

try {
//retrieve the file data
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream stream = file.getInputStream();
//write the file to the file specified
OutputStream bos = new FileOutputStream("/testImages");
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();
data = "The file has been written to \"" + "/testImages" + "\"";
logger.debug(data);
//close the stream
stream.close();
}
catch (FileNotFoundException fnfe) 
{
return null;
}
catch (IOException ioe) 
{
return null;
}

//place the data into the request for retrieval from display.jsp
//                      request.setAttribute("text", text);
//                      request.setAttribute("queryValue", 
queryValue);
request.setAttribute("fileName", fileName);
request.setAttribute("contentType", contentType);
request.setAttribute("size", size);
request.setAttribute("data", data);

//destroy the temporary file created
file.destroy();

//return a forward to display.jsp
return mapping.findForward("edit_success");


--- In [EMAIL PROTECTED], Michael McGrady <[EMAIL PROTECTED]> wrote:
> The method setMaxFile(long) exists even in older versions.  So, are 
you 
> doing something other than tossing a long value into that method?
> 
> Michael McGrady
> 
> Travis Reeder wrote:
> 
> >Looks like you need the latest commons-fileupload.jar.
> >
> >Travis 
> >
> >-----Original Message-----
> >From: Marwan Salam [mailto:[EMAIL PROTECTED] 
> >Sent: Thursday, October 21, 2004 10:21 AM
> >To: [EMAIL PROTECTED]
> >Subject: FileUpload Errors
> >
> >
> >Hi all,
> >
> >I am using Struts 1.1 and I am trying to upload an image file to 
the
> >server but I keep getting the below exception. I have used the 
example
> >that comes with Struts under jakarta-struts-1.1\webapps and did 
exactly
> >like they have but still getting the exception. I have put print
> >statements all over the Action but the problem is that the request 
is
> >not even getting to the action. No compile errors whatsoever. I 
also
> >have commons-logging.jar in my WEB-INF\lib.
> >
> >My JSP looks like:
> >
> ><html:form action="maintainItem" enctype="multipart/form-data">
> >
> >            .
> >            .
> >            .
> > Select Image: <html:file name="maintainItemForm" 
property="myFile"/>
> ><br> <html:submit onclick="dispatch.value='uploadImage'" 
value="Upload
> >Image"/>
> >            .
> >            .
> >            .
> ></html:form>
> >
> >I have defined the form in struts-config.xml and the request does 
not
> >even hit the action.
> >
> >
> >[10/21/04 12:08:24:171 CDT] 6ea2663c RequestProces I 
> >org.apache.struts.action.RequestProcessor  Processing a 'POST' for 
> >path '/maintainItem'
> >[10/21/04 12:08:24:936 CDT] 6ea2663c WebGroup      E SRVE0026E: 
> >[Servlet Error]-[org.apache.commons.fileupload.FileUpload: method 
> >setSizeMax&#40;I&#41;V not found]: java.lang.NoSuchMethodError: 
> >org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V 
not 
> >found
> >     at 
> 
>org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> >(CommonsMultipartRequestHandler.java:219)
> >     at org.apache.struts.util.RequestUtils.populate
> >(RequestUtils.java:1055)
> >     at org.apache.struts.action.RequestProcessor.processPopulate
> >(RequestProcessor.java:798)
> >     at org.apache.struts.action.RequestProcessor.process
> >(RequestProcessor.java:254)
> >     at org.apache.struts.action.ActionServlet.process
> >(ActionServlet.java:1422)
> >     at org.apache.struts.action.ActionServlet.doPost
> >(ActionServlet.java:523)
> >     at javax.servlet.http.HttpServlet.service
> >(HttpServlet.java:760)
> >     at javax.servlet.http.HttpServlet.service
> >(HttpServlet.java:853)
> >     at 
> >com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService
> >(StrictServletInstance.java:110)
> >     at 
> >com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service
> >(StrictLifecycleServlet.java:174)
> >     at com.ibm.ws.webcontainer.servlet.IdleServletState.service
> >(StrictLifecycleServlet.java:313)
> >     at 
> >com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service
> >(StrictLifecycleServlet.java:116)
> >     at com.ibm.ws.webcontainer.servlet.ServletInstance.service
> >(ServletInstance.java:283)
> >     at 
> >com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch
> >(ValidServletReferenceState.java:42)
> >     at 
> >com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch
> >(ServletInstanceReference.java:40)
> >     at 
> 
>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDi
s
> >patch(WebAppRequestDispatcher.java:948)
> >     at 
> >com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch
> >(WebAppRequestDispatcher.java:530)
> >     at 
> >com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward
> >(WebAppRequestDispatcher.java:176)
> >     at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward
> >(WebAppInvoker.java:79)
> >     at 
> >com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook
> >(WebAppInvoker.java:201)
> >     at 
> 
>com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvoc
a
> >tion(CachedInvocation.java:71)
> >     at 
> >com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI
> >(ServletRequestProcessor.java:182)
> >     at 
> >com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service
> >(OSEListener.java:334)
> >     at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest
> >(HttpConnection.java:56)
> >     at com.ibm.ws.http.HttpConnection.readAndHandleRequest
> >(HttpConnection.java:610)
> >     at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
> >     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
> >
> >Any help would be appreciated.
> >
> >Marwan
> >
> >
> >
> >
> >
> >-------------------------------------------------------------------
--
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >-------------------------------------------------------------------
-----------
> >This e-mail message is for the sole use of the intended recipient
(s) and contains confidential and/or privileged information belonging 
to Siebel Systems, Inc. or its customers or partners.  Any 
unauthorized review, use, copying, disclosure or distribution of this 
message is strictly prohibited.  If you are not an intended recipient 
of this message, please contact the sender by reply e-mail and 
destroy all soft and hard copies of the message and any attachments.  
Thank you for your cooperation.
> >====================================================
> >
> >
> >-------------------------------------------------------------------
--
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >  
> >
> 
> 
> 
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to