Page 1 of 1

is_file problem

Posted: Mon Sep 08, 2008 5:24 am
by huyhk
Hi all,
Please help me to solve this problem.
I have two PHP code files
test.php

Code: Select all

 
<?
if (is_file("includes/info.inc"))
{
    echo "file exists";
    include "includes/info.inc";
}
?>
 
and info.inc in includes subfolder

When i place test.php in my web root, is_file not work==> nothing display on the screen.
http://demo.viennam.com/test.php

After that, i create a sub folder test and copy both test.php and includes folder into test.
http://demo.viennam.com/test/test.php
It's OK.

But after browsing to http://demo.viennam.com/test/test.php, i browsed http://demo.viennam.com/test.php. This time it's OK :( :(

I don't know why.

I am running PHP 5.2.6 on Windows Server 2003.

Do I need to change anything in my php.ini file?

Re: is_file problem

Posted: Mon Sep 08, 2008 6:24 am
by JAB Creations
Are you trying to determine something about the file or if it exists?

I think this may be what you want...

Code: Select all

if (file_exists($my_file)) {echo 'file exists';}