HttpPostedFile PostedFile = Request.Files[i]; if (PostedFile.ContentLength > 0) { Guid guid = Guid.NewGuid(); string fileNameOrg = Path.GetFileName(PostedFile.FileName); string extention = Path.GetExtension(fileNameOrg); string fileNameNew = fileNameOrg.Replace(extention, "") + guid + extention; PostedFile.SaveAs(path + @"\" + fileNameNew); }
string inp = "text1eb4617fd-4876-4c52-aa5b-21f8be8fb0f8.txt"; const int guidLen = 36; int extLen = inp.Length - inp.LastIndexOf('.'); string filename = inp.Substring(0, inp.Length - (extLen + guidLen)) + Path.GetExtension(inp);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)