Object reference not set to an instance of an object.

  • Thread starter Thread starter Mike John
  • Start date Start date
M

Mike John

I am trying to browse for a picture and save to the server
image folder
I tried the following code:

HTML:*********************
<INPUT id="UpLoadFile" style="Z-INDEX: 140; LEFT: 140px;
WIDTH: 377px; POSITION: absolute; TOP: 488px; HEIGHT:
22px" type="file" size="43" runat="server">

ASP:***************************
Private Sub UpLoadImage()







Dim hpfIS As HttpPostedFile
hpfIS = UpLoadFile.PostedFile ' uploadfile is the
id of an intput type 'file' that I have created in html

If hpfIS.ContentLength = Nothing Then
Exit Sub
End If

hpfIS.SaveAs(Server.MapPath("images") & "\" &
Me.txtRecID.Text & ".jpeg")


End Sub

any reason why I am geting the error :"Object reference
not set to an instance of an object. "


sincerely yours


Mike John
 
Back
Top