Author: shahid.majeed | Posted on: 7/4/2009 5:38:48 AM | Views : 254

Hi friends i have a error in my file upload control. i select the file that i want to upload, but when i click the upload button. its give the this error. i dont know why this error come.
Error:
Object reference not set to an instance of  an object.
here is my Upload Button Code code

protected void Button2_Click(object sender, EventArgs e) { string strFileName; strFileName = FileField.PostedFile.FileName; string c = System.IO.Path.GetFileName(strFileName); try { Image2.Visible = true; FileField.PostedFile.SaveAs("C:\\UploadedUserFiles\\" + c); Image2.Visible = false; Label2.Visible = true; } catch (Exception exp) { Label2.Text = exp.Message.ToString(); Label2.Visible = true; } }
Here is My page Code
Go to the complete details ...