title: Multiple file upload Html Jsp
body: <p>I am trying to upload two files,
  but the submit button in the webpage is not working. it won't trigger the  event. 
  but still not working.However its works when I upload a single file. Here J-query is used for change on select drop-down list . if its MMS or VCF then we have to upload second file. at time only submit is not working. </p>
  
  <pre><code>        $("select#msgtype").change(function () {
  
              var mt =   $("#msgtype").val();
  
  
  
              if(mt == 'VCF' || mt == 'MMS'){
              $("#taM").hide();
              $("#bus11").show();
              }else{
              $("#taM").show();
              $("#bus11").hide();
              }
              });
  
  
      });
  
  
  function fun()
  {
      alert("submit");
         window.document.form11.action="newcamp.jsp";
         window.document.form11.method= "post";
          window.document.form11.enctype="multipart/form-data";
         window.document.form11.submit();
  }
  </code></pre>
  
  <p>and html form</p>
  
  <pre><code> &lt;form name="form11" &gt;
  
  &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;label class="lab"&gt;MSISDN:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;&lt;label class="lab1"&gt;&lt;%= msisdn %&gt;&lt;/label&gt;&lt;/td&gt;
  
     &lt;/tr&gt;
           &lt;tr&gt;
        &lt;td&gt;&lt;label class="lab"&gt;SourceAddress:&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="Text" id="c" size="35" class="text1" name="c" /&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  
  
  &lt;tr&gt;
        &lt;td&gt;&lt;label class="lab"&gt;CampaignName:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="Text" id="c1" size="35" class="texta" name="cname"/&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  
  &lt;tr&gt;
      &lt;td&gt;&lt;label class="lab"&gt;Message Type:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt; &lt;select name="cp" class="texta" id="msgtype"  style="width: 328px " &gt;
                          &lt;option value="TEXT"&gt;Text&lt;/option&gt;
                          &lt;option value="FLASH"&gt;Flash Message&lt;/option&gt;
                          &lt;option value="VCF"&gt;Business Card&lt;/option&gt;
                          &lt;option value="unicode"&gt;Language/Unicode Message&lt;/option&gt;
                          &lt;option value="MMS"&gt;MMS&lt;/option&gt;
                          &lt;/select&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;label class="lab"&gt;Message:&lt;/label&gt;&lt;/td&gt;
    &lt;td&gt;&lt;div id="bus11"&gt;
        &lt;input type="file"  name="file"  /&gt;
   &lt;/div&gt;
    &lt;div id ="taM"&gt;
  &lt;textarea rows=3 cols=35 name="msg" id="msg1" class="texta"&gt;&lt;/textarea&gt;
  
  &lt;/div&gt;
  &lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;label class="lab"&gt;StartTime:&lt;/label&gt;&lt;/td&gt;
    &lt;td&gt;
      &lt;input type="Text" id="demo1" size="35" name="stime" class="texta" on/&gt;
      &lt;img src="images/cal.gif" onclick="javascript:NewCssCal('demo1','yyyyMMdd','dropdown',true,'24',true)" style="cursor:pointer"/&gt;
  
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;td&gt;&lt;label class="lab"&gt;EndTime:&lt;/label&gt;&lt;/td&gt;
    &lt;td&gt;
      &lt;input type="Text" id="demo2" size="35" class="texta" name="etime" /&gt;
      &lt;img src="images/cal.gif" onclick="javascript:NewCssCal('demo2','yyyyMMdd','dropdown',true,'24',true)" style="cursor:pointer"/&gt;
  
  &lt;/td&gt;
  
  &lt;tr&gt;
    &lt;TD&gt; &lt;/TD&gt;
    &lt;TD&gt;&lt;/TD&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;label class="lab"&gt;ListofMSISDN:&lt;/label&gt;&lt;/td&gt;
    &lt;td&gt;
          &lt;input type="file" id="fl1" name="file"  /&gt;
    &lt;/td&gt;
  
  &lt;tr&gt;
    &lt;td COLSPAN=2&gt;&lt;CENTER&gt;&lt;br&gt;
                &lt;input TYPE="submit" id="submit1" NAME="submit" VALUE="submit" onclick="fun();" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      &lt;input TYPE="reset" class="button" /&gt;&lt;/CENTER&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>thanks for your quick reply but when i try to upload two file at that time its not even going to jsp file  ......... my jsp code is </p>
  
  <pre><code>List&lt;String&gt; field = new ArrayList&lt;String&gt;();
  List&lt;FileItem&gt; items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
  
  
  for (FileItem item : items) {
              if (item.isFormField()) {
                  String fieldvalue = item.getString();
                  field.add(fieldvalue);
              } else {
  
  
                   InputStream filecontent = item.getInputStream();
                   myString = IOUtils.toString(filecontent, "UTF-8");
  
              }
          }
  </code></pre>