I'm trying to check if a directory exists and if not create it, but the page does not work for me when I use the functions "file_exists" or "is_dir".
I've tried it this way:
if(!file_exists( $path )
mkdir($path);
And so:
if(!is_dir ( $path )
mkdir( $path );
And I've also tried to use the path with different formats:
According to the documentation, if I'm on windows, I should do it like this:
$path= "C://Apache24/htdocs/uploads/carpeta"
Although I have also tried to do so
$path ="C:/Apache24/htdocs/uploads/carpeta"
And so
$path= "./uploads/carpeta"
Even so:
$path= $_SERVER['DOCUMENT_ROOT']."/uploads/carpeta"
In all cases it fails me. In the local I'm working on Windows but I suppose that when I upload it to the hosting it has to run on Linux.
Does anyone know why these functions fail or how to fix it?