public void SaveImage(HttpPostedFileBase image, String serverPath, String pathToFile) { if (image == null) { return; } if (!String.IsNullOrEmpty(this.Profileimage)) { // delete the old picture before adding new picture ImageModel.DeleteFile(serverPath + Profileimage); } //ImageModel Guid guid = Guid.NewGuid(); ImageModel.ResizeAndSave(serverPath + pathToFile, guid.ToString(), image.InputStream, 200); Profileimage = pathToFile + guid.ToString() + ".jpg"; }