this is dring me nuts! I have a web app i have created using ASP .net core2. I have a registration page that allows a user to select an image file and this is working. I use this is my Model:
[Display(Name = "Face Image")]
Public IFormFile UserImageFile { get; set; }
In my AccountController class I have
public async Task<IActionResult> Register(RegisterViewModel model, string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
if (ModelState.IsValid)
{
var imageBytes = GetByteArrayFromImage(model.UserImageFile);
var user = new ApplicationUser { UserName = model.Email, Email = model.Email, UserImage = imageBytes};
user.UserImage = imageBytes;
var result = await _userManager.CreateAsync(user, model.Password);
This all seems to work. If I debug and look at the user, I can see that UserImage has a byte array. All seems ok BUT the field in the database isnt getting the value. Is there a step I have to add somewhere that is hidden to set this value on the database?