![](/img/trans.png)
[英]ASP.Net MVC displaying stored .zip files and allowing downloading from database
[英]Downloading files from the database in Asp.Net Mvc
我將我的文件存儲在數據庫中,需要在單擊按鈕時下載文件。
我可以在動作方法中獲取文件內容(二進制)。 但是如何將其作為文件返回給用戶?
<%= Html.ActionLink("download file", "download") %>
在你的行動中:
public ActionResult Download()
{
byte[] contents = GetFileContentsFromDatabase();
return File(contents, "image/jpeg")
}
return new FileContentResult(byte[], contentType)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.