//Here i am assuming that the folder in which you want to store images is “UserPhotos” and File Uploader control name is UploadPhoto
string Path = Server.MapPath(“UserPhotos”);
Random r = new Random();
string FileName = r.Next().ToString();
string FileExtention = UploadPhoto.FileName.Substring(UploadPhoto.FileName.LastIndexOf(‘.’));
FileName = FileName + FileExtention;
string FilePath = Path + @”\” + FileName;
UploadPhoto.SaveAs(FilePath);
imgPhoto.ImageUrl = FilePath;
Advertisement