Categories.Pictire is byte[]. In <input type="file" asp-for="Picture"/> I2 want to upload picture througt UploadImage like a byte[]. But I get null from view.
<form asp-action="UploadImage" asp-controller="Categories" method="post">
<div>
<label asp-for="Picture"></label>
<span asp-validation-for="Picture"></span><br/>
<img src='@Url.Action("GetCategoryImage", "Categories", new { id = Model.CategoryId })' /><br/>
<input asp-for="Picture" />
</div>
<br/>
<div class="form-group">
<input asp-for="CategoryId" type="hidden" />
<input type="submit" name="save" class="btn btn-primary" value="Upload" />
</div>
</form>
public async Task<IActionResult> UploadImage(Category category)
{
_db.Get(category.CategoryId).Picture = category.Picture;
await _db.SaveChangesAsync().ConfigureAwait(false);
return Redirect("Index");
}
