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
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
Jump to PostAre 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.
Jump to PostYour 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.
Jump to Postnot working
Please read this forum's read-me and you'll understand why that comment is completely worthless to us.
Jump to PostYou could always do an absolute...
$dir = $_SERVER['DOCUMENT_ROOT']; $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 …
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.
not working
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.
i'm not sure will work because the code is in a included file through many levels
You could always do an absolute...
$dir = $_SERVER['DOCUMENT_ROOT'];
$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)"
If you're on a remote/hosted server: http://www.mydigitallife.info/php-scripts-open_basedir-restriction-in-effect-error/
If you're on localhost, then disable open_basedir. Check to see if you're running in safe mode. If so, turn it off. I may get spanked for saying that, but it causes problems IMO.
i dont have any control over the server
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
Do you have cPanel WebHost Manager or Plesk?
Where on your website is the actual file stored?
e.g. http: //www.mywebsite.com/assets/images/avatar.jpg
here's the image
www.jocurigratisonlinenet.ro/user/axxxA/avatar.jpg
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.