How am I going to upload an image (if this method is possible) with this following code :
js :
$.ajax({
type: "POST",
url: '@Url.Action("FirstAjax", "TrainingCourse")',
data: JSON.stringify({file:"C:\\Users\\jmanaban\\Downloads\\image.jpg"}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successFunc,
error: errorFunc
});
and in my controller :
public ActionResult FirstAjax(String file)
{
\\do process here
return Json(file, JsonRequestBehavior.AllowGet);
}
I'm still a newbie in c# so I'm not so sure if I'm doing the right thing here. I've seen lots of code snippet in the internet but I like to just pursue this one if possible. Thanks experts.