Hello.
I'm trying to do a very simple upload using velocity and struts. This
is my html:
<html>
<body>
<form name="myForm" method="post" action="<my action goes here>"
enctype="multipart/form-data">
Select File: <input type="file" name="myFile"> </br>
<input type="submit" value="Upload File">
</form>
</body>
</html>
For some reason I'm getting this error...
java.lang.InternalError: erroneous handlers
at
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Ljavax/servlet/http/HttpServletRequest;)V(CommonsMultipartRequestHandler.java:???)
at
org.apache.struts.util.RequestUtils.populate(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/http/HttpServletRequest;)V(RequestUtils.java:445)
Does anyone have any clue what this could be about? Also - my
struts-config file:
<form-bean
dynamic="true"
name="myForm"
type="org.apache.struts.action.DynaActionForm">
<!-- inputs -->
<form-property name="myFile"
type="org.apache.struts.upload.FormFile"/>
</form-bean>
I was creating my own action form but currently just trying to keep it
basic.
<action
path="/FileUpload"
name="myForm"
type="my.package.StrutsUploadAction">
<forward name="success" path="/success.vm"/>
</action>
Any ideas would be greatly appreciated.
Thank you!
Try replacing
> Select File: <input type="file" name="myFile"> </br>
with Select File : <html:file property="myFile"/></br>
If this does not work, try getting rid of the dyna form altogether, and
parse the multipart request in your action. I am not sure what type
<input type=file> puts in the request, but your action is expecting a
FormFile, which can be the error you are observing.
-cheers,
Manish
watergirl - 10 Oct 2006 15:24 GMT
> Try replacing
>
[quoted text clipped - 9 lines]
> -cheers,
> Manish
Manish.
Thank you for the suggestion. I tried removing the dyna form and
parsing via the multi part request object and got the same
error...Still at a loss!
Thanks.
Steph
Manish Pandit - 10 Oct 2006 16:57 GMT
Hi!
Can you check and see if the jakarta fileupload library version is same
on your tomcat vs. your IDE/build location? If there is a fileupload
jar in tomcat, get rid of it so that it will always pick up the one in
your WEB-INF/lib.
-cheers,
Manish
watergirl - 10 Oct 2006 21:38 GMT
Thanks Manish! I removed old jars and made sure the only ones that I
wanted to use were in my WEB-INF/lib and it works great :)