这是我上传文件的代码。它上传文件并保存到上传文件夹中。现在想要在数据库中保存文件名。我该怎么做才能将文件名保存在数据库中。
public ActionResult FileUpload(upload mRegister)
{
//Check server side validation using data annotation
if (ModelState.IsValid)
{
//TO:DO
var fileName = Path.GetFileName(mRegister.file.FileName);
var path = Path.Combine(Server.MapPath("~/Content/Upload"), fileName);
mRegister.file.SaveAs(path);
ViewBag.Message = "File has been uploaded successfully";
ModelState.Clear();
}
return View();
}