7
Answers

file upload using mvc

Ask a question
Dipika

Dipika

7y
209
1
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)