Page 1 of 1
Recognise If A Directory Exists?
Posted: Sun Sep 17, 2006 1:52 pm
by JustinMs66
i need the PHP code for recognising if a directory named "userfiles" exists.
i also need the PHP code for redirecting to another PHP file.
Posted: Sun Sep 17, 2006 1:56 pm
by feyd
Difficulty digging them out?
file_exists() and
is_dir() and
header(). Amazing.
Posted: Sun Sep 17, 2006 2:06 pm
by JustinMs66
ok so i did this:
Code: Select all
<?php
if (is_dir('userfiles')){
echo "userfile DOES exist";
else
echo "userfiles does NOT exist";
?>
and it outputs this:
Parse error: syntax error, unexpected T_ELSE in /index.php on line 4
but i can't see what i did wrong! please help!
Posted: Sun Sep 17, 2006 2:10 pm
by feyd
braces...
Posted: Sun Sep 17, 2006 2:25 pm
by JustinMs66
... braces? do you mean brackets? if so, where do i put them?
Posted: Sun Sep 17, 2006 2:46 pm
by toasty2
Code: Select all
<?php
if (is_dir('userfiles'))
{
echo "userfiles DOES exist";
} //You were missing this brace
else
{ //and this brace
echo "userfiles does NOT exist";
} //and this brace.
?>