View Full Version : is_file() / file_exists() problem
SeeIT Solutions
05-25-2005, 02:41 AM
Hi, I was trying to make a script that shows an "image not available" image if the image doesn't exist.
the file_exists() keeps failing but the file is there, I know it is a problem with the path to the file but I don't know how to get it. I've used $_SERVER['DOCUMENT_ROOT'] and /home/user/public_html with no luck...
any suggestions?
Fou-Lu
05-25-2005, 04:40 AM
Try using a relative path instead.
Without seeing what you have I cannot suggest anything else that may solve the problem.
SeeIT Solutions
05-25-2005, 04:48 AM
I've tried every type of path so far, it isn't a problem with my code because I have used the same code elsewhere and it worked... it is a problem with how php was set up for this particular account.
Thanks for your help though
mordred
05-25-2005, 08:34 AM
You probably have an error somewhere else. Post the code so we can have a look at it.
delinear
05-25-2005, 09:35 AM
Have you tried using realpath() to find the path to the file?
Try creating the following file in the same directory as your image, it should tell you the path you need to use.
<?php
echo realpath('imagename.gif');
?>
SeeIT Solutions
05-25-2005, 02:38 PM
Problem solved, the php wasn't set up properly on the server.
Thanks anyway
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.