【发布时间】:2014-08-06 16:38:44
【问题描述】:
我之前已经将一个文件上传到我的数据库中,现在我想从我的数据库中下载该文件。
谁能告诉我怎么做?我是 C# 和 ASP.NET MVC 的新手。
控制器:
public ActionResult Details(string id = null)
{
Assignment assignment = db.Assignments.Find(id);
if (assignment == null)
{
return HttpNotFound();
}
return View(assignment);
}
型号:
public string AssignmentID { get; set; }
public Nullable<System.DateTime> SubmissionDate { get; set; }
public string Status { get; set; }
[Range(0,100, ErrorMessage="Only Value between 0-100 is accepted.")]
public Nullable<decimal> Mark { get; set; }
public string Comments { get; set; }
public byte[] FileLocation { get; set; }
查看:
<div class="display-label">
<%: Html.DisplayNameFor(model => model.FileLocation) %>
</div>
<div class="display-field">
<%: Html.DisplayFor(model => model.FileLocation) %>
</div>
【问题讨论】:
-
我的回答没有问题。。 .is mazor part of answer.....thankzz..@WeakestInCoding....
-
@WeakestInCoding....工作????
标签: c# asp.net asp.net-mvc asp.net-mvc-4 httppostedfilebase