Last active
March 16, 2016 10:53
-
-
Save bjoerntx/eaca4743c7fa74873b63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Index() | |
{ | |
Document document = new Models.Document(); | |
MemoryStream ms = new MemoryStream(); | |
FileStream fs; | |
// load the document into a stream | |
using (fs = System.IO.File.OpenRead( | |
Server.MapPath("/App_Data/documents/document.docx"))) | |
{ | |
fs.CopyTo(ms); | |
document.BinaryDocument = Convert.ToBase64String(ms.ToArray()); | |
} | |
// forward the document to the view | |
return View(document); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment