javascript - Multiple files upload using AJAX -


i'm working on webapp , i'm using multiple files upload, doesn't work ajax. multiple files upload use apache fileupload working after using ajax servletfileupload.ismultipartcontent() returns false.

thanks

here jsp code :

<!doctype html> <html>     <head>     <meta charset="utf-8" />     <title>envoi des fichiers rnp</title>         <script src="js/jquery-1.11.3.min.js"></script>         <script src="js/fileupload.js"></script>          <link type="text/css" rel="stylesheet" href="css/form.css">     </head>     <body>         <form id="myform" >             <fieldset>                 <legend>envoi de fichier</legend>                 <label for="fichier">emplacement du premier fichier <span class="requis">*</span></label>                 <input type="file" id="fichier" name="fichiers[]" multiple value="<c:out value="${fichier.nom}"/>"/>                 <span class="erreur">${form.erreurs['fichier']}</span>                 <br />                 <br />                 <input type="submit" value="envoyer" id="showtable"/>                 <br />             </fieldset>         </form>         <div id="tablediv">             <table cellspacing="0" id="site2g">                 <tr>                     <th scope="col">cgi</th>                     <th scope="col">bsc</th>                     <th scope="col">site name</th>                     <th scope="col">cells</th>                     <th scope="col">ea</th>                          </tr>             </table>         </div>           </body> </html> 

and ajax code :

 $(document).ready(function() {$("#tablediv").hide();  $("#myform").submit(function(event){      event.preventdefault();       var formdata = new formdata($(this)[0]);       $.ajax({             url: "upload",             type: 'post',             data: formdata,             async: false,             cache: false,             contenttype: false,             processdata: false,             success: function(responsejson) {                 if(responsejson!=null){                     $("#site2g").find("tr:gt(0)").remove();                     var table1 = $("#site2g");                     $.each(responsejson, function(key,value) {                          var rownew = $("<tr><td></td><td></td><td></td><td></td><td></td></tr>");                             rownew.children().eq(0).text(value['bsc']);                             rownew.children().eq(1).text(value['sitename']);                             rownew.children().eq(2).text(value['cells']);                             rownew.children().eq(3).text(value['cgi']);                             rownew.children().eq(4).text(value['ea']);                             rownew.appendto(table1);                     });                     }                 }           });         $("#tablediv").show();}); }); 

you can prefer third party plugins upload multiple files server

a few recommend

they support

multiple file upload.

progress bar

what after file has uploaded

image preview


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -