Author
Struts upload not working
Sree Jag
Ranch Hand
Joined: Oct 14, 2003
Posts: 77
Hi all, I am trying to add File Upload functionality to my webapp using Struts <html:file> This is my JSP code: <html:form action="/itemmaintenance.do" enctype="multipart/form-data" onsubmit="self.opener.location.reload(false);self.close();"> <html:file name="itemmaintenanceForm" property="theFile"/> <html:image property="image" src="/Images/Admin/btnSave.gif" onclic="this.form.submit()"/> </html:form> but when i click on the Save image, the form is submitted without any data. But it submits all the data if i remove the enctype="multipart/form-data" from the html:form tag, the form is being submitted with all the data. Can anyone tell me what's the problem? Thanks in advance, Seshu
Sree Jag<br />SCJP 1.4
hrt prasad
Greenhorn
Joined: Sep 02, 2004
Posts: 4
posted Sep 02, 2004 12:07:00
0
Try putting method="post" in the form tag. also - "onclic" for image - Is this a spelling mistake?
Sree Jag
Ranch Hand
Joined: Oct 14, 2003
Posts: 77
hi hr, i tried with method="post" too with no luck. btw, onclic is not a typo...javaranch was not allowing me to post message with onclick. any other ideas?
Sree Jag
Ranch Hand
Joined: Oct 14, 2003
Posts: 77
i found the problem. the problem is not with <b>enctype="multipart/form-data"</b>. the problem is with the <b>onsubmit</b> function. if i remove teh onsubmit function, then the upload file is working. any ideas how to solve this problem Seshu
subject: Struts upload not working