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 JohnTry Dim hpfIS As New HttpPostedFile!
HTH
>--Original Message--
>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
>.
Thursday, March 22, 2012
Object reference not set to an instance of an object.
Labels:
asp,
browse,
codehtmlltinput,
folderi,
following,
instance,
net,
object,
picture,
reference,
save,
serverimage,
uploadfile
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment