i store doc file into sql server data base i want view this file on my view page how i can view this file on view plz any one help me
my class code is here
public class Candidate : System.ComponentModel.IDataErrorInfo
{
[Column]
public byte[] FileData { get; set; }
[Column]
public string Filecontent { get; set; }
}
my controllercode is here;
public ActionResult CreateCandidate(Candidate candidate, HttpPostedFileBase file)
{
candidate.Filecontent = Request.Files["file"].ContentType;
Stream filestream = Request.Files["file"].InputStream;
int filelength = Request.Files["file"].ContentLength;
candidate.FileData = new byte[filelength];
filestream.Read(candidate.FileData, 0, filelength);
IcandidateRepository.SaveCandidate(candidate);
return RedirectToAction("CandidateDetails", new { id =
candidate.CandidateID });
}
i store this file in binary format plz give me sample code
You could have a controller action which would allow users to download this file:
Now, what is left is to provide your users with a link on the view so that they can download it: