How To Browse for an image file and save it to image server folder

M

Mike John

I trying to browse for an image file and save it to the
server image folder.
in other words , upload the picture.

I tried html and aspx.net code:
html:***************************************
<INPUT id="UpLoadFile" style="Z-INDEX: 140; LEFT: 248px;
WIDTH: 87px; POSITION: absolute; TOP: 538px; HEIGHT: 2px"
type="file" onchange="UpLoadFileImage()" size="1"
runat="server">

asp.net:*** 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")
*********************************

but I have receieved an error.
err :

Object reference not set to an instance of an object.
the object in this case is hpfis

please help

sincerely yours

Mike John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top