Click here to Skip to main content
15,901,368 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want upload image and save in one folder whit same name . how to use guid for this ?
Posted

1 solution

try like below

C#
string file = "mytest.jpg";
string basePath = Server.MapPath("~/Images");
string guid = Guid.NewGuid().ToString();
var Fullpath = Path.Combine(basePath, guid);
// create directory
Directory.CreateDirectory(Fullpath);
fileupload1.SaveAs(Path.Combine(Fullpath ,guid + Path.GetExtension(file))
 
Share this answer
 
Comments
raana1988 22-Apr-14 3:38am    
this is exactly what i need ... thanks a lot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900