I have code as below:
$dir = opendir("D:/Marcin");
if ($dir) {
echo "OK";
}
else {
echo "not ok";
}
and I get not ok, why??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I believe you are trying to open a directory server-side. If you were doing so locally, it would work – as I can see that you are getting the directory from your PC, but instead, you are attempting to execute the script in the client-side, and getting a server-side result.
This means that if that directory doesn’t exist on your server, the server will not be able to find the file – and will return false.
At a certain point, you must check whether the directory exists on your server.
If both of the two are cross-referenced, it will return to false.
Hope this assists.