我使用下面的C#代码将.doc文件保存为SQL Server数据库varbinary(max)
。我应该如何将.doc文件保存到SQL Server数据库
我可以保存文件,但是当我检索文件并想要在网页上显示内容时,我的代码正在下载文件,我对如何处理它非常困惑。
我正在寻找的确切功能是naukri.com上传简历并给出预览。我的代码是:
byte[] fileContent = new byte[fuResume.PostedFile.ContentLength];
fuResume.PostedFile.InputStream.Read(fileContent, 0, fuResume.PostedFile.ContentLength);
//lblAppliedMessage.Text = ByteArrayToString(fileContent);
//lblAppliedMessage.Text = BitConverter.ToString(fileContent).Replace("-", string.Empty);
byte[] btYourDoc;
btYourDoc = fileContent;
Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition", "inline;filename=yourfilename.doc");
Response.OutputStream.Write(btYourDoc, 0, fileContent.Length);
Response.BinaryWrite(btYourDoc);
Response.End();
我同意你的意见 – Tan