我正在尝试更新文件,但是单击更新后,文件名未显示在文本框中,有关更清晰的图片,请参阅该图片,
cshtml代码为
<div class="form-group">
@Html.ReqLabelFor(model => model.file_path, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-5 offset-md-5">
@*@Html.TextBox("upload", null, new { type = "file", accept = "image/*", @class = "form-control" })*@
@Html.TextBox("file", null, new { type = "file", @class = "form-control" })
@Html.ValidationMessageFor(model => model.file_path, "", new { @class = "text-danger" })
</div>
</div>
c#代码为
File fileDownload = await db.File.Where(x => x.id == id).FirstOrDefaultAsync();
其中file_path是字符串类型。