Answer the question
In order to leave comments, you need to log in
How to retrieve a file from a database?
Good time!
I am writing an ASP.NET MVC net461 project.
I save an arbitrary file (.doc, .xls, etc.) in the MSSQL database. I store it as byte[]. But I can’t understand how I can download this file from the link on the client side? How to convert a byte array to a file?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
He who has hands, google it!
public ActionResult Index()
{
byte[] contents = GetPdfFileData();
return File(contents, "application/pdf", "test.pdf");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question