-
1
- #1
I am getting the value for the image name from the SQL database. I then want to check if the image exists in the images folder, if it exists it should show the image, if the image is not there it should show a standard image, which is (noimage.gif). I have written the code as below.
set fso = Server.Createobject("Scripting.FileSystemObject"
path = "securePath & 'products/images/' & rs('imageUrl')"
'path is the path to the if fso.FileExists(path) then%>
<a href="viewItem.asp?idProduct=<%=rs("idProduct"%>"><img src='<%=securePath%>products/images/<% =rs("imageUrl"%>' border=0 width=100></A>
<%else%>
<img src="<%=securePath%>products/images/imageNA.gif%>" border=0 width=100>
<%end if%>
However when I run the script it always goes to else part even if the image is there. It does not show the image. If I check the properties of the image it shows as below.
I do not know why I am getting the % sign at the end. Can some help me.
set fso = Server.Createobject("Scripting.FileSystemObject"
path = "securePath & 'products/images/' & rs('imageUrl')"
'path is the path to the if fso.FileExists(path) then%>
<a href="viewItem.asp?idProduct=<%=rs("idProduct"%>"><img src='<%=securePath%>products/images/<% =rs("imageUrl"%>' border=0 width=100></A>
<%else%>
<img src="<%=securePath%>products/images/imageNA.gif%>" border=0 width=100>
<%end if%>
However when I run the script it always goes to else part even if the image is there. It does not show the image. If I check the properties of the image it shows as below.
I do not know why I am getting the % sign at the end. Can some help me.