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

Discussion in 'ASP .Net' started by Mike John, Jul 28, 2003.

  1. Mike John

    Mike John Guest

    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
    Mike John, Jul 28, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan
    Replies:
    7
    Views:
    18,505
    catherine sea
    Oct 28, 2010
  2. Replies:
    1
    Views:
    782
    Mark Rae
    Feb 26, 2006
  3. Santel
    Replies:
    7
    Views:
    683
    siccolo
    Mar 5, 2008
  4. Aldric Giacomoni
    Replies:
    0
    Views:
    90
    Aldric Giacomoni
    Jan 5, 2010
  5. Replies:
    0
    Views:
    188
Loading...

Share This Page