Results 1 to 4 of 4

Thread: I need help displaying an image

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    104

    I need help displaying an image

    Hello Everyone

    I am new in vesual basic and i have a couple of questions:

    I have the following code that is allowing me to save an image uploaded from a user into a root folder
    HTML Code:
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
            Dim fileName As String = Path.GetFileName(FileUploadUserProfile.PostedFile.FileName)
    
            FileUploadUserProfile.PostedFile.SaveAs((Server.MapPath("~/ImageStorage/") + fileName))
    
            Response.Redirect(Request.Url.AbsoluteUri)
        End Sub
    Question one:
    Once i upload the file and i click on the ImageStorage folder, i don't see an image, but if i exit the entire applicxation and then i go back in i am able to see the image. How can i refresh the folder wothout having to exit the application?

    Question two:
    I am trying to display the image once is uploaded. i have the following to display the image:
    HTML Code:
    <img src="string url = ResolveUrl("~/ImageStorage/" + filename)" />
    once the page is uploaded i don't see an image, instead i see a little square with a red X

    Thank you for your help

    BK

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: I need help displaying an image

    Moved to the ASP.Net forum.

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: I need help displaying an image

    Don't think you can give code to an <img />.
    You need the url of the image.
    About the first.It won't really matter what you will see on your own PC. Better test it on a server and see the behavior there.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    104

    Re: I need help displaying an image

    Hello Sapator

    Thanks for your reply. Do you think you can provide me with an example on how use the URL or how can i change the line bolow?
    HTML Code:
    <img src="string url = ResolveUrl("~/ImageStorage/" + filename)" />
    Thank you in advance

    BK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width