Page code:
Server code:
public class UpdateAction extends DispatchAction { Public actionforward uploader (actionmapping mapping, actionform form, HttpServletRequest request, Httpservletresponse response) { UpFormForm upformform = (Upformform) form; formfile ff = upformform.gethousemaps (); try { inputstream is = ff.getinputstream ( ); file file = new File ("d:/" + ff.getfilename ()); //specifies the path and filename of the file store outputstream os = new FileOutputStream (file); byte[] b = new byte[1024]; int len = 0; while ((Len = is.read (b)) !=  -1) { Os.write (B, 0, len); } os.close (); is.close (); } catch (exception e) { &Nbsp; e.printstacktrace (); } return null; }}
Note: Server code can be a method in the action in the file upload previously implemented by struts;
The main method of uploading files is Ajax, you need to specify the following:
URL: "; Need to link to server address
Fileelementid: ",//The id attribute of the file selection box