Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
So I uploaded the image To server using file upload control


VB
 Dim path As String = Server.MapPath("~/upload/Photo/")
FileUpload.SaveAs(path & ImageName & ".jpg")


and on page load I'm displaying the image
VB
img.ImageUrl = Server.MapPath("~/upload/Photo/") & ImageName & ".jpg"


But the image is not displayed! What did I miss here???
Posted
Updated 21-Apr-14 22:41pm
v2
Comments
Ajith K Gatty 22-Apr-14 5:46am    
Hi,

I don't know VB.NET.I'm just giving a try.
I think there is a mistake in your img.ImageUrl.
Server.MapPath("~/upload/Photo/" & ImageName & ".jpg");
check once.
[no name] 22-Apr-14 7:58am    
Not working too
VICK 22-Apr-14 6:25am    
"Inspect Element" in browser and see what ImageURL the application have created. and than right click on that and "Open Image in New Tab" to see what is wrong in that.
[no name] 22-Apr-14 7:58am    
Nothing it says Not Available ???
VICK 23-Apr-14 7:02am    
When its says "Not Available" ???? after you clicked on "Open Image in new Tab"???

IF yes, than check the URL of that page. and see what is the difference in that and the correct Image URL.

Hi
Server.MapPath("~/upload/Photo/" & ImageName & ".jpg");


Check this once.
 
Share this answer
 
Comments
[no name] 22-Apr-14 7:59am    
Not working
Make sure you have all the right permissions to read the folder where you place the file.
Permissions are described here[^],
 
Share this answer
 
Comments
[no name] 22-Apr-14 8:09am    
I don't have aspnet user in my security tab I added the IUSR
I removed the Server.MapPath and it worked:

img.ImageUrl = "~/upload/Photo/" & ImageName & ".jpg"
 
Share this answer
 

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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900