John

John

  • NA
  • 928
  • 131.9k

file upload using mvc

Feb 28 2017 6:02 AM
Below is my ajax call
How to send a file uploaded to action method in the following format only using ajax.
The parameter in the data file will not change. 
 
$.ajax({
type: "Post",
url: '/Student/SaveApplication',
data: "mobilenumber=" + mobilenumber + "&quota=" + quota + "&subjectList=" + subjectList,
datatype: 'json',
contentType: "multipart/form-data",
processData: false,
cache: false,
success: function (op) {
}
}); 
 
 
The action method will also be parameterized
public ActionResult SaveApplication(string subjectList,string mobilenumber,string quota)
{
//code to save data 
}
 
 

Answers (7)