Reputation: 473
I have this code to check if a folder exists using PHP and it works correctly with xampp in windows, but when I try to move that page to a server, it doesn't work.
Here is my code:
function validate (&$valores, &$errores, $campo, $carpeta) { $valores [$campo] = $carpeta; if ((file_exists($carpeta) && is_dir($carpeta))==false) { $errores[$campo] = true; } else { $errores[$campo] = false; } }
There is an alternative to the code that I'm doing?
Upvotes: 0
Views: 1101
Reputation: 473
Solution: I added to PHP open_basedir folders and files I wanted to change, and then with Filezilla I've modified the read / write permission and fixed.
Upvotes: 1
Reputation: 78971
Your code should operate fine on both platforms, so its not this issue.
Usually, such problem due to the naming system
. The linux based OS using strict case sensitive naming system.
So try to fix that.
Upvotes: 0
Reputation: 191
You can use http://de.php.net/manual/en/function.opendir.php and check for false.
Upvotes: 0