I work with asp mvc, not core.
public IFormFile ThumbnailImage {get; set; } change to :
public HttpPostedFileBase ThumbnailImage {get; set; }
in your view change form to this code:
@using (Html.BeginForm("Update", "Home", FormMethod.Post, new { enctype = "multipart/form-data", onsubmit = "return SubmitForm(this)" }))
{
<div class="form-group">
<input name="ThumbnailImage" type="file" />
</div>
<div class="form-group">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
}
and script change to this code:
function SubmitForm(form) {
var formData = new FormData($(form)[0]);
$.ajax({
url: form.action,
type: form.method,
data: formData,
processData: false,
contentType: false,
success: function (response) {
alert(response);
}
});
return false;
}
and in controller change your action to this:
[HttpPost]
public async Task<JsonResult> Update(ProductUpdateRequest model)
{
//update db
return Json("success");
}