pripojuji cely kod.nevim kde delam chybu ale proste to nefunguje.test provadim na
www.pristavisteujezu.cz/kamt.phpzde je cely kod :
<?php
$dir = "/pristavisteujezu.cz/www/kamera/192.168.20.21/($dat)/";
$pattern = '\.(jpg|JPG)$'; // check only file with these ext.
$newstamp = 0;
$newname = "";
$new = "obraz.jpg";
$ dat = date('Y-m-d');
// error_reporting(E_ERROR | E_WARNING | E_PARSE);
if ($handle = opendir($dir)) {
while (false !== ($fname = readdir($handle))) {
// Eliminate current directory, parent directory
// Eliminate other pages not in pattern
$timedat = filemtime("$dir/$fname");
if ($timedat > $newstamp) {
$newstamp = $timedat;
$newname = $fname;
}
}
}
closedir ($handle);
chdir($dir);// nastavení adresáře
rename ($newname,$new);//přejmenovaní souboru
$zdroj ="/pristavisteujezu.cz/www/kamera/192.168.20.21/$dat/obraz.jpg";// doporučuji absolutní cestu
$cil = "/pristavisteujezu.cz/www/kam/obraz.jpg";// doporučuji absolutní cestu
copy($zdroj,$cil);
unlink($newname); //smazání souboru
?>