this is the code

if (file_exists('/user/'.$_SESSION['Username'].'/avatar.jpg')) {
echo 'Exists';
} else {
    echo 'Doesn\'t exist';

and i get the negative case

Are you sure you are referring to the right path? The slash before user directs it to the root of your server. Perhaps it should be ./user/, which finds the user folder in the current directory.

Member Avatar

Your related thread stated this at the end...

i solve it with dirname(__FILE__)

Which I thought was overkill, as './'by pritaeas pretty much sets the location relative to the current directory.

not working

Please read this forum's read-me and you'll understand why that comment is completely worthless to us.

i'm not sure will work because the code is in a included file through many levels

Member Avatar

You could always do an absolute...

$dir .= '/subdirectory1/subsubdirectory7/';

This assumes that you haven't stored the upload directory above the document root. This is a bit of a fudge though.

Setting constants like UPLOAD_PATH like these in your top include file (e.g. config.php file) can often obviate these types of problems.

i get "open_basedir restriction in effect. File(/usr/local/apache/htdocs/user/name_of _user/avatar.jpg) is not within the allowed path(s)"

Member Avatar

You looked at the link?

yes but there it tells me to modify apache configurations and restart it. I cant do that on my host

Member Avatar

Do you have cPanel WebHost Manager or Plesk?

Where on your website is the actual file stored?

e.g. http: //

here's the image

i don't have cpanel or plesk, i have somekind of control panel

i have somekind of control panel

I think it might be best if you raised a support ticket with your host.