Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find if file is present

Status
Not open for further replies.

TheCandyman

Technical User
Sep 9, 2002
761
US
I want to look in a directory (images) and see if a picture is there, if so show it. But im not sure how it make it work, this is what i have so far.


<% if %>(images/<%=PartNo%>) = &quot;&quot; <%then%>
<img src=&quot;images/<%=PartNo%>.jpg&quot; alt=&quot;No Picture Available&quot; width=&quot;265&quot; height=&quot;217&quot;>
<%else%>
<img src=&quot;images/<%=PartNo%>.jpg&quot; alt=&quot;<%=PartNo%>&quot; width=&quot;265&quot; height=&quot;217&quot;>
<%end if%>


Any help????
[wavey2]
 
Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
if fs.FileExists(&quot;c:\Inetpub\ then
response.write(&quot;<img src=blah.png>&quot;)
end if
set fs=nothing

Adjust accordingly.
 
Need alittle more help... It maps the path, but i can't seem to get the 'FileExists' to work ??


Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
ImagePath = Server.MapPath(&quot;IOPimages&quot;)
FilePath = ImagePath & &quot;\&quot; & PartNo
if fs.FileExists(FilePath) then
showflag = 1
end if


***** This part works - shows picture *****
if showflag <> &quot;1&quot; then .....


 
Have you dumped the value of FilePath out to the browser to verify what it is? If so post it along with the actual file path for the resource.

-pete
I just can't seem to get back my IntelliSense
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top