Combined with flash, you can easily upload multiple files. You can select multiple files at a time.
This example uses three third-party libraries:
Apache commons fileupload http://commons.apache.org/fileupload/
Apache commons Io http://commons.apache.org/io/
Swfupload http://swfupload.org/
Paste belowCode.
The first is the form for upload.
"> Swfuploadv2.2.0simple demo
Then the receiver JSP
items; try {items = upload. parserequest (request);} catch (fileuploadexception e) {// throw new servletexception (E );} // all objects have been successfully updated before they have been updated before waiting for (Object VAL: items) {fileitem item = (fileitem) val; If (item. isformfield () {// type = "file" other than "file" contains multiple outgoing records. println (item. getfieldname ();} else {// type = "file" contains invalid variable file F = new file (item. getname (); try {item. write (new file ("C:/Windows/Temp", F. getname (); out. println (F. getname ();} catch (ioexception e) {Throw E;} catch (exception e) {Throw new servletexception (e) ;}}%>