Is there a way to get the contents of files stored as binary in database? I want to get the content of pdf file to search in it.
For example search for particular word. I'm using ASP.NET MVC with EF6 and SQL Server.
This code for storing files in the database:
[HttpPost]
public ActionResult FileUpload(FileDetail Fd, HttpPostedFileBase files)
{
String FileExt = Path.GetExtension(files.FileName).ToUpper();
if (FileExt == ".PDF")
{
Stream str = files.InputStream;
BinaryReader Br = new BinaryReader(str);
Byte[] FileDet = Br.ReadBytes((Int32)str.Length);
Fd.FileName = files.FileName;
Fd.FileContent = FileDet;
db.FileDetails.Add(Fd);
db.SaveChanges();
//other code
}
else
{
//other code
}
}
Edit I will use iTextsharp thanks