I store my files in a database and should load the file at the click of a button.I can get the contents of the file (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") }
return new FileContentResult(byte[], contentType)