I already make a part of that function but when i do the check on my dir if they exist dont give any error, maybe u can help me found the miss part. Part of my function:
public function teste_mkdir(){
$rootPath = '/var/www/oncargo/files/oncargophotos/';
$data = '2022-11-25 23:59:45';
$ano = date ('Y', strtotime($data));
$mes = date ('m', strtotime($data));
$dia = date ('d', strtotime($data));
$path1 = $rootPath.$ano;
$path2 = $path1.'/'.$mes;
$path3 = $path2.'./'.$dia;
//check if folders exists before create
if(!is_dir($rootPath) == true){
if(!is_dir($path1) == false)
mkdir($path1,0777,true);
if(!is_dir($path1) == true)
if(!is_dir($path2) == false)
mkdir($path2,0777,true);
if(!is_dir($path2) == true)
if(!is_dir($path3) == false)
mkdir($path3,0777,true);
}
// print_r(array('ls' => scandir($path1))); make this to see if they are made but dont show nothing because they arent made
// print_r(array('ls' => scandir($path2)));
// print_r(array('ls' => scandir($path3)));
}
i alredy try make path1,2 andd 3, made i fail the rootPath is manual created. So im trying to get a new dir when data change, so every day when i receive a img that function have to create a dir for every single day. Its my purpose.Can u help me?