i want to show an exciting file from my db into the details page
and i have this problem that the file saved as a long path like this :
D:\Projects\asp\Portail_Candida\Portail_Candida\CandidatCvs\ayman_jarmoune_cv_fr.pdf
and when i wanna see it it doesn't shows,
the only way that shows that it needs to be "~/CandidatCvs/as.pdf"
here's my code :
this is the save methode :
public ActionResult Upload(Candidateur candida)
{
using (RecrutementPortailEntities entity = new RecrutementPortailEntities())
{
var candidate = new candidature()
{
NomCandidature = candida.NomCandidature,
PrenomCandidature = candida.PrenomCandidature,
MailCandidature = candida.MailCandidature,
TeleCandidature = candida.TeleCandidature,
NiveauEtudeCandidature = candida.NiveauEtudeCandidature,
CvCandidature = SaveToPhysicalLocation(candida.CvCandidature),
NumbMoisExperienceCandidature = candida.NumbMoisExperienceCandidature,
DatedepositCandidature = DateTime.Now,
DernierEmployeeCandidature = candida.DernierEmployeeCandidature
};
entity.candidatures.Add(candidate);
entity.SaveChanges();
}
return View(candida);
}
private string SaveToPhysicalLocation(HttpPostedFileBase file)
{
if (file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("\\CandidatCvs"), fileName);
file.SaveAs(path);
return path;
}
return string.Empty;
}
and here's the cshtml :
<div>
<embed src="@Model.CvCandidature" type="application/pdf" height="700" width="700">
</div>