You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Flávio Maldonado <fv...@yahoo.com.br> on 2005/12/27 19:52:12 UTC

Upload File

Hello

I'm having a problem to upload a file using struts...
I search for the error at Google... but I didn't solve my problem yet.
I have this JSP:

 <html:form action="/foto" enctype="multipart/form-data">
 <tr>
  <td>

  <table cellpadding="0" cellspacing="15" width="100%">
   <tr>
    <td width="50%" align="right"><html:file property="theFile" 
size="40"/></td>
   </tr>
   <tr>
    <td width="50%" align="right"><html:submit value="Ok"/></td>
   </tr>
  </table>  </td>
 </tr>
 </html:form>

when I click in Ok button to call the action class, the servlet throws an 
exception:

java.lang.NoSuchMethodError: 
org.apache.commons.fileupload.FileUpload.setSizeMax(I)V at 
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common 
sMultipartRequestHandler.java:220) at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:934)  at

I got the struts-upload.war example and it works fine... but my application 
didn't! I don't know what i'm doing wrong...
I put the struts.jar and commons-upload.jar in the classpath....
I think this is a detail... but I'm not seeing what I'm doing wrong.

Something can help me?

Thanks.

Have a happy new year.

Flávio Maldonado 


	

	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Upload File

Posted by Laurie Harper <la...@holoweb.net>.
Flávio Maldonado wrote:
> Hello
> 
> I'm having a problem to upload a file using struts...
> I search for the error at Google... but I didn't solve my problem yet.
> I have this JSP:
> 
> <html:form action="/foto" enctype="multipart/form-data">
> <tr>
>  <td>
> 
>  <table cellpadding="0" cellspacing="15" width="100%">
>   <tr>
>    <td width="50%" align="right"><html:file property="theFile" 
> size="40"/></td>
>   </tr>
>   <tr>
>    <td width="50%" align="right"><html:submit value="Ok"/></td>
>   </tr>
>  </table>  </td>
> </tr>
> </html:form>
> 
> when I click in Ok button to call the action class, the servlet throws 
> an exception:
> 
> java.lang.NoSuchMethodError: 
> org.apache.commons.fileupload.FileUpload.setSizeMax(I)V at 
> org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(Common 
> sMultipartRequestHandler.java:220) at 
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:934)  at
> 
> I got the struts-upload.war example and it works fine... but my 
> application didn't! I don't know what i'm doing wrong...
> I put the struts.jar and commons-upload.jar in the classpath....
> I think this is a detail... but I'm not seeing what I'm doing wrong.
> 
> Something can help me?

I'd guess you have the wrong version of commons-upload.jar deployed. 
Check you're using the right version, and that there isn't another 
version elsewhere on the classpath of either your application or your 
servlet container.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Upload File

Posted by Daniel Blumenthal <da...@wordchamp.com>.
This probably won't help, but (you never know) - you might want to specify
method="POST".  So:

<html:form action="/foto" enctype="multipart/form-data" method="POST">

Just a thought.

Daniel

> -----Original Message-----
> From: Flávio Maldonado [mailto:fvmaldonado@yahoo.com.br] 
> Sent: Tuesday, December 27, 2005 1:52 PM
> To: Struts Users Mailing List
> Subject: Upload File
> 
> Hello
> 
> I'm having a problem to upload a file using struts...
> I search for the error at Google... but I didn't solve my problem yet.
> I have this JSP:
> 
>  <html:form action="/foto" enctype="multipart/form-data">  <tr>
>   <td>
> 
>   <table cellpadding="0" cellspacing="15" width="100%">
>    <tr>
>     <td width="50%" align="right"><html:file property="theFile" 
> size="40"/></td>
>    </tr>
>    <tr>
>     <td width="50%" align="right"><html:submit value="Ok"/></td>
>    </tr>
>   </table>  </td>
>  </tr>
>  </html:form>
> 
> when I click in Ok button to call the action class, the 
> servlet throws an
> exception:
> 
> java.lang.NoSuchMethodError: 
> org.apache.commons.fileupload.FileUpload.setSizeMax(I)V at 
> org.apache.struts.upload.CommonsMultipartRequestHandler.handle
> Request(Common
> sMultipartRequestHandler.java:220) at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java
> :934)  at
> 
> I got the struts-upload.war example and it works fine... but 
> my application didn't! I don't know what i'm doing wrong...
> I put the struts.jar and commons-upload.jar in the classpath....
> I think this is a detail... but I'm not seeing what I'm doing wrong.
> 
> Something can help me?
> 
> Thanks.
> 
> Have a happy new year.
> 
> Flávio Maldonado 
> 
> 
> 	
> 
> 	
> 		
> _______________________________________________________
> Yahoo! doce lar. Faça do Yahoo! sua homepage. 
> http://br.yahoo.com/homepageset.html 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org