I have data in varbinary type in database from "Artifact" table like
ID CONTENT
1 Some data in varbinary type
Now i want to get the "Content" column data and should download as PDF format in Users Download folder with name "Report.PDF " file.
How should i this? I have tried like
But, not getting, can anybody help me
ID CONTENT
1 Some data in varbinary type
Now i want to get the "Content" column data and should download as PDF format in Users Download folder with name "Report.PDF " file.
How should i this? I have tried like
Code:
public ActionResult DownloadFile(int fileId) { ResLandEntities reslandEntities = new ResLandEntities(); var content = reslandEntities.ARTIFACT.Where(m => m.ID== fileId).FirstOrDefault(); byte[] contents = content.CONTENT; string text = Encoding.UTF8.GetString(contents); return File(Server.MapPath("~/download/Report.PDF"), "application/pdf", text ); }