I can post only data or uploaded file with Jquery but I want to post them to same method same time.I searched alot but I could only find file upload.When I try I get "Illegal invocation" error. Here is my code can you help me please.
View:
var upfile = document.getElementById('fileupload').files[0];
$.post("/Home/JobApplicationSave", { fc: $("#JobForm").serializeObject(),
fileUpload:upfile}, function (data) {
if (data.Result== true) {
FancyAlerts1.show({ msg: 'Thank you' });
}
else
{
FancyAlerts1.show({ msg: data.Error});
}
});
Controller:
public ActionResult JobApplicationSave(FormCollection fc, HttpPostedFileBase fileUpload)
{
//some code
}