Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

Object ref not set to an instance of the Object.

Jan 24 2012 2:11 AM
Hi

 

string PicExtension = "";
        string newpic = "";
        if (fuUploadFile.PostedFile.ContentLength > 0)
        {
            string ImageName = fuUploadFile.PostedFile.FileName;
            string[] Pic = ImageName.Split('.');
            PicExtension = Pic[1].ToString();
            newpic = "1" + "." + PicExtension;
            string virtualpath = Server.MapPath(@".\UserProfilePic\" + newpic); //Server.MapPath(@".\UserPicPath\" + newpic);


            fuUploadFile.PostedFile.SaveAs(virtualpath);
}


It is giving error "Object reference not set to an instance of the object".

Thanx


Answers (2)