Click here to Skip to main content
13,250,883 members (51,454 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Dear all,
Issue: Unable to display image using FilePath

I have File Upload button which captured the file path & when I click on Upload button, it should be display the image which I have selected. But its not happening?

What I missed here?? do I need to convert the path to image url?? If Yes then please provide me the code behind it??

Thanks in advance..

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim path As String
 
        path = Server.MapPath(FileUpload1.FileName)
 
        Image1.ImageUrl = path
        Label1.Text = Image1.ImageUrl
End Sub
Posted 27-Apr-13 21:55pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

What I missed here?? do I need to convert the path to image url?? If Yes then please provide me the code behind it??
Yes, you need to first upload the image at certain location and then refer that path to the image source.

FileUpload control does not show the entire path generally and will not help you to extract and use as is.
  Permalink  
Comments
sawantmayur 28-Apr-13 3:33am
   
Thanks SandeepM..

But In run time, it shows me the entire path in my label control where the image exists. Then why Image control is not able to grab the image using same path??

Do you have any example regarding this then please provide me..

Thanks again...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 28 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100