Strut multiple file uploads

Source: Internet
Author: User

jquery dynamically add dynamic Add File upload box and dynamic delete upload box

<script type= "Text/javascript" >$ (function ()         {             $ ("#button"). Click (function ()              {                 var html = $ ("<input type= ' file '   Name= ' upload ' > ');                 var button = $ ("<input type= ' button '  name= ' button '  value= ' delete ' ><br > ");                                 $ ("#div"). AppendChild (HTML). appendchild (Button);                 &nbSp;               button.click ( function ()                 {                      html.remove ();                     button.remove ();                 })              })         }) </script><form  action = "${ Ctx}/order/upload.action " method=" post " enctype=" Multipart/form-data "><input name=" upload " type=" File "><input type=" button " value=" Add " id=" button "><br><div  Id= "Div" ></div><button> Submit </button></form> 


Background code:

private list<file> upload;private list<string> uploadcontenttype;private  List<string> uploadfilename;public string upload () {  //Server store upload file directory    String destpath = servletactioncontext.getservletcontext (). Getrealpath ("/upload");   System.out.println (DestPath);   file file=new file (DestPath);   if (!file.exists ())  file.mkdirs ();   system.out.println (file);         try  {                for   (Int i=0;i<upload.size (); i++)          {    fileutils.copyfile (upload.get (0),  new file (File,uploadfilename.get (i)));          }  } catch  (ioexception e)  {    e.printstacktrace ();   return ERROR;  }    return SUCCESS;      }

Reference article:

Http://www.cnblogs.com/xiaoluo501395377/archive/2012/10/26/2740882.html


Strut 2 Single File upload:

http://tianxingzhe.blog.51cto.com/3390077/1681576


This article is from the "Nothing-skywalker" blog, please be sure to keep this source http://tianxingzhe.blog.51cto.com/3390077/1681604

Strut multiple file uploads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.