storing images in filesystem

Discussion in 'ASP .Net Web Controls' started by nbs6@yahoo.com, Feb 16, 2008.

  1. Guest

    I am convinced that I want to store images in filesystem as to
    database and store path into database Can someone point out an
    article as to how to do it or help me I am using fileupload method but
    I am getting nowhere
    , Feb 16, 2008
    #1
    1. Advertising

  2. I'm not sure where the best article would be found, but I'm sure you could
    find plenty with a search. But here is a basic example that should get you
    started:

    If fileupload1.HasFile AndAlso fileupload1.FileContent.Length > 0 Then
    If Not System.IO.File.Exists(Server.MapPath(String.Concat("/",
    fileupload1.FileName))) Then
    Me.fileupload1.PostedFile.SaveAs(Server.MapPath(String.Concat("/",
    fileupload1.FileName)))
    End If
    End If

    The first If statement checks to make sure a file has been selected and that
    the file actually has content. The second If statement checks to make sure
    that there is not already a file in the directory with that name. If both of
    these If statements pass, then the SaveAs method of the PostedFile property
    of the FileUpload control is called. Take note that you do not have to use
    the filename of the original file, although whether or not you do depends on
    the intended usage of you application. Also, take note of the Server.MapPath
    function that I used. This is important, because you must specify the path
    on the server. Hopefully this will get you started; if you have any
    questions that you cannot find answers to, feel free to ask.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    <> wrote in message
    news:...
    >I am convinced that I want to store images in filesystem as to
    > database and store path into database Can someone point out an
    > article as to how to do it or help me I am using fileupload method but
    > I am getting nowhere
    Nathan Sokalski, Feb 17, 2008
    #2
    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. blackg
    Replies:
    2
    Views:
    572
    blackg
    Mar 9, 2005
  2. Adam J Knight

    Storing Images?

    Adam J Knight, Feb 2, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    510
    RedHair
    Feb 5, 2006
  3. Kostatus

    storing images

    Kostatus, Aug 24, 2003, in forum: C++
    Replies:
    0
    Views:
    422
    Kostatus
    Aug 24, 2003
  4. toton
    Replies:
    11
    Views:
    706
    toton
    Oct 13, 2006
  5. Jonathan Wood
    Replies:
    1
    Views:
    507
    Jonathan Wood
    Jun 2, 2008
Loading...

Share This Page