syntax of path to file_exists

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
t_ravichandu
Forum Newbie
Posts: 3
Joined: Fri Aug 20, 2004 4:21 am

syntax of path to file_exists

Post by t_ravichandu »

Hi all,

i'm usin the following code to determine whether a file exists or not. While i can see that the file really exists at the given path..the result in the browser is "not exists". giving the code..

Code: Select all

<?php 

if( file_exists('/html/ravi/sing.JPEG') ){ 
echo "exists"; 
} 
else echo "not exists"; 
?>

i think the problem is in the way i give the path, i mean the syntax.
pls correct me.
chandu
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

The syntax looks fine, it has to be down to the path which should be an absolute path rather than a relative one.
From a command prompt 'ls -la /html/ravi/sing.JPEG' should work fine if the path is correct, does it?
Post Reply