Ayush Patil

Ayush Patil

  • 1.8k
  • 156
  • 10.4k

Upload file with multiple Parameter

Jan 2 2019 6:27 AM
Hi all,
 
I want to upload file with multiple parameter.
 
Here is the my code
 
function Upload(srID) {
var fileUploadUrl = $('#fileUploadData_' + srID).val();
var PolicyNo = $('.tbltr' + srID).find("td:eq(3)").text();
var files = new FormData();
var filePath = document.getElementById('fileUploadData_' + srID).files[srID];
files.append('files[' + srID + ']', filePath);
$.ajax({
type: 'POST',
url: '/GHI/UploadFiles',
data: files,
dataType: 'json',
cache: false,
contentType: false,
processData: false,
success: function (response) {
ShowAlert('Files have been uploaded successfully');
},
error: function (error) {
ShowAlert('Error has occured. Upload is failed');
}
});
}
How i can pass the parameter through Ajax call to controller 
 
 

Brought to you by:

Answers (3)