PHP file_exists function

software development

#1

Hey guys,

Having a bit of trouble… all of my file_exists() php function calls are returning false. When calling this function how should I format my absolute path?
I have been using my site root.
for example:
if (file_exists(’/wine_images/000435.jpg’))

do i need to format my path differently?
if so how?

Thanx alot guys i really appreciate any light you can shed for me.

John


#2

Since you are using / at the start of the file, is the folder structure
www.domain.com/wine_images/000435.jpg
?
If so then you might want to check out this thread.

I’ve used this fine using “…/images” and “/images” so I don’t know about your problem *-)


#3

Thanks for the response decs…
yes my folder structure was as you assumed.
I ended up solving the problem with the following code:

if (file_exists($DOCUMENT_ROOT."/wine_images/00342.jpg))

$DOCUMENT_ROOT did the trick just fine… i worked in relation to that.

Thanks again for your response!