Click here to Skip to main content
15,998,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
//var fileInput = document.getElementById('fi');
var count = $("input[type=file]")
for (j = 0; j < count.length; j++)
{
   var formdata = new FormData(); //FormData object
   var fileInput = document.getElementById(count[j].id);
   //Iterating through each files selected in fileInput
   for (i = 0; i < fileInput.files.length; i++)
   {
      //Appending each file to FormData object
      formdata.append(fileInput.files[i].name, fileInput.files[i]);
   }
   //Creating an XMLHttpRequest and sending
   $.ajax(
   {
      url: '/Booking/Upload',
      type: 'POST',
      contentType: false,
      processData: false,
      data: {formdata ,"file":"1"
   },
   success: function (data)
   {
      alert(data);
   }
});
Posted
Updated 13-May-14 3:54am
v3
Comments
Sunasara Imdadhusen 13-May-14 9:44am    
So what is your error? are getting any error using this code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900