upload file AJAX

JS function upFile(){ var data = new FormData($('#file')[0]); var urlx="/bdp/fileup" console.log("data:"+data); $.ajax({ url: urlx, type: 'POST', data: data, async: false, enctype: 'multipart/form-data', cache: false, contentType: false, processData: false, success: function (data) { console.log(data); } }); } HTML formulario: <form id="file" method="post" enctype="multipart/form-data"> <div style="height:0px;overflow:hidden"> <input type="file" id="fileInput" name="none" /> </div> Read more…