i have used below code to save image in directory. But when i try to save another image its being replaced on old image. i want to save all image with unique no assume the image name is as current date
dd-MM-yy i want to store as like below
dd-MM-yy_01, dd-MM-yy_02, dd-MM-yy_03, dd-MM-yy_04
code is below.
int i = 0;
i++;
vImage.ImageUrl = i.ToString();
con.Close();
if (!Directory.Exists(Server.MapPath(MainDir + SubDir +"/")))
{
Directory.CreateDirectory(Server.MapPath(MainDir + SubDir + "/"));
}
string imgname = (DateTime.Now.ToString("dd-MM-yy") + i.ToString() + ".jpg");
File.WriteAllBytes(Path.Combine(Server.MapPath(MainDir + SubDir), imgname), imgbytes);