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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if file exists in web directory

Status
Not open for further replies.

malleykr

Programmer
Mar 22, 2001
24
US
Hi.

I am trying to display a .gif file on my page. The .gif is a picture of the current user. The .gif files are stored off the company's home page (e.g. They are not located on the coldfusion server.

The problem is that the pictures do not exist for all users. I want to write code that will determine if the file exists. If it exists, I want to display it, if not, I want to display another .gif indicating that no picture is on file.

I have tried FileExists() but that does not seem to work for it only seems to work for actual directories. Does anyone have any other ideas that would work for me?

Thanks in advance for any help you can provide.
 
Try this,

<CFSET NamePicVar=&quot;PamilaAnderson.gif&quot;>
<CFDIRECTORY NAME=&quot;filelist&quot; DIRECTORY=&quot;FILTER=&quot;*.gif&quot;>

<CFOUTPUT QUERY=&quot;filelist&quot;>
<CFIF #Name# EQ #NamePicVar#>
Yeah...
<CFELSE>
BOOOO!
</CFIF>
</CFOUTPUT>

I really dont know if this will work so just try it out. I dont have time to test it but I would like to know what you come up with.
:)))
 
Chief where are you leading her?! haha, nope that won't work.

CFDIRECTORY only works on directories the web server has access to.

What're you... on dope?
 
hey strantheman,

Will i was writing that cops were storming into my nieghbors across the hall because they had a meth-lab. My mind wasn't very clear. Oh well....
 
Wow that sounds like an interesting night. Yikes. I don't blame you for wanting to busy yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top