我刚好做过一个这样的东西,大概思路是将每次上传的文件保存在session中,然后一并提交完成

解决方案 »

  1.   

    ByteArrayOutputStream baosLicence = new ByteArrayOutputStream();
          ByteArrayOutputStream baostaxLicence = new ByteArrayOutputStream();
          ByteArrayOutputStream baosorganiseNo = new ByteArrayOutputStream();
          try {
            InputStream streamLicence = provider.getLicence().getInputStream();
            InputStream streamtaxLicence = provider.getTaxLicence().getInputStream();
            InputStream streamorganiseNo = provider.getOrganiseNo().getInputStream();
            //taxLicence
            byte[] bufferLicence = new byte[8192];
            int bytesReadLicence = 0;
            while ((bytesReadLicence = streamLicence.read(bufferLicence, 0, 8192)) != -1) {
                  baosLicence.write(bufferLicence, 0, bytesReadLicence);
            }
            //taxLicence
            byte[] buffertaxLicence = new byte[8192];
            int bytesReadtaxLicence = 0;
            while ((bytesReadtaxLicence = streamtaxLicence.read(buffertaxLicence, 0, 8192)) != -1) {
                  baostaxLicence.write(buffertaxLicence, 0, bytesReadtaxLicence);
            }
            //organiseNo
            byte[] bufferorganiseNo = new byte[8192];
            int bytesReadorganiseNo = 0;
            while ((bytesReadorganiseNo = streamorganiseNo.read(bufferorganiseNo, 0, 8192)) != -1) {
                  baosorganiseNo.write(bufferorganiseNo, 0, bytesReadorganiseNo);
            }
            ps.setBinaryStream(11,new ByteArrayInputStream(baosLicence.toByteArray()),baosLicence.toByteArray().length);
            System.out.println(provider.getLicence().getFileSize());
            ps.setBinaryStream(12,new ByteArrayInputStream(baostaxLicence.toByteArray()),baostaxLicence.toByteArray().length);
            System.out.println(provider.getTaxLicence().getFileSize());
            ps.setBinaryStream(13,new ByteArrayInputStream(baosorganiseNo.toByteArray()),baosorganiseNo.toByteArray().length);
            System.out.println(provider.getOrganiseNo().getFileSize());
            provider.getLicence().destroy();
            provider.getTaxLicence().destroy();
            provider.getOrganiseNo().destroy();
      

  2.   

    provider是form对象,你可以参考看看
      

  3.   

    这个是表单
          <tr>
              <td class=td noWrap colspan="3">
                <input class=edline
                style="WIDTH: 250px; HEIGHT: 22px" type=file name=licence>
        </td>
            </tr>
            <tr>
              <td class=td noWrap colspan="3">
                <input class=edline
                style="WIDTH: 250px; HEIGHT: 22px" type=file name=taxLicence>
        </td>
            </tr>
            <tr>
              <td class=td noWrap colspan="3">
                <input class=edline
                style="WIDTH: 250px; HEIGHT: 22px" type=file name=organiseNo>
        </td>
            </tr>
      

  4.   

    Struts中有上传得类,支持多个文件上传。到apache网站上下在一个struts的例子研究一下
      

  5.   

    同意Yansharp(喜之郎)的说法
    很简单的哦
      

  6.   

    Struts中有org.apache.struts.upload.FormFile类的,再用getInputStream这个方法就可以了.
      

  7.   

    至于一个或多个,没什么不一样,只要用FormFile类就行了.