public async Task <IActionResult> Create([Bind("ID,FullName,Age,DOJ,FileName")] Employee employee, IFormFile fileName) { if (ModelState.IsValid) { string path = Environment.CurrentDirectory; string fullName = Path.Combine(path, "wwwroot", "Images", fileName.filename); employee.fileName = fullName; _context.Add(employee); await _context.SaveChangesAsync(); // upload file if (FileName.Length > 0) { using (var stream = System.IO.File.Create(fullName)) { await FileName.CopyToAsync(stream); } } return(RedirectToAction(nameof(Index))); } return(View(employee)); }