Welcome Guest, Not a member yet? Register   Sign In
file_exists dosnt seem to be working right
#1

[eluser]R_Nelson[/eluser]
Code:
<?php
$user_path = base_url()."members/$id/image01.jpg";
echo $user_path;
if(!file_exists($user_path))
{
$id = 0;
}
?>

in my root i have a directory members in that is directory's that are the same as the user ID the directory 1 has image01.jpg in it and 2 dose not when the ID is 2 i don't display a graphic at all but it should be showing the default graphic stored in 0. I'm not sure why i'm getting this result it works fine in normal PHP.
#2

[eluser]R_Nelson[/eluser]
its gona be one of those nights i removed the base_url() and it works just fine!
#3

[eluser]InsiteFX[/eluser]
If your running CI 2.0+ there is an .htaccess file in the application directory that denys all!

InsiteFX
#4

[eluser]R_Nelson[/eluser]
once i removed the base_url it worked fine but i believe i have the .htacess file removed in the root
#5

[eluser]InsiteFX[/eluser]
Hi R_Nelson,

Here is the PHP net version.
Code:
// as you can see they are not using a full path.
$filename = '/path/to/foo.txt';

if (file_exists($filename))
{
    echo "The file $filename exists";
}
else
{
    echo "The file $filename does not exist";
}

InsiteFX
#6

[eluser]toopay[/eluser]
This line :
Code:
$user_path = base_url()."members/$id/image01.jpg";
You should try to echoing '$user_path'. If it pointing to something like :
Code:
C:\\your\base_path/members/some_id/image01.jpg
, then fix 'slash/backslah' stuff in that string to the right 'path' format, should be working.
#7

[eluser]R_Nelson[/eluser]
thx for the answers but i fixed it about 2 messages ago look up!




Theme © iAndrew 2016 - Forum software by © MyBB