Monday, 20 May 2013

Open SQL FileStream with MVC

Open SQL FileStream with MVC

I have a database table that stores files using SQL FileStream.
I have enabled full file streaming capibilities in SQL Instance
I would like to produce a hyperlink that will allow me to open the file in an external application (Word, visio, excel) and re-save it after making changes. Is this possible with FileStream?
Currently this is the code i am using to view the document. But this does not appear to be using the FileStream capibility.
public FileContentResult GetDoc(int id)
    {
        Document doc = db.Documents.Single(o => o.Id == id);



        byte[] fileContent = null;
        string mimeType = "";
        string filename = "";

        fileContent = (byte[])doc.DocumentContents;
        mimeType = doc.DocumentMimeType;
        filename = doc.DocumentFileName;

        return File(fileContent, mimeType, filename);

    }

No comments:

Post a Comment