Anant Jain

Anant Jain

  • NA
  • 61
  • 8.3k

save only substring

Sep 21 2015 6:36 AM
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.";
}