save only substring of path in database with asp.net mvc
if (file != null && file.ContentLength > 0)
{
try
{
path = Path.Combine(Server.MapPath("~/Upload"),
Path.GetFileName(file.FileName);
file.SaveAs(path);
tapalmaster.FileUploadPath = Path.GetFileName(file.FileName);
ViewBag.Message = "File uploaded successfully";
byte[] pic = new byte[file.ContentLength];
file.InputStream.Read(pic, 0, file.ContentLength);
}
catch (Exception ex)
{
ViewBag.Message = "ERROR:" + ex.Message.ToString();
}
}
else
{
ViewBag.Message = "You have not specified a file.";
}