I'm storing my files in the database and need to download a file when button clicked. i can get the File content (Binary) in the action method. But how to return it as a file to the user?
<%= Html.ActionLink("download file", "download") %>
and in your action:
public ActionResult Download() { byte[] contents = GetFileContentsFromDatabase(); return File(contents, "image/jpeg") }
2.1m questions
2.1m answers
60 comments
57.0k users