When an image is uploaded to the server, it is copied to the folder where the download handler itself is located, in addition to moving to the persistent folder. Tell me how to level this effect. Code related to downloading a file:
$uploaddir = '../images/uploads/directors/'; $uploadfile = $uploaddir . basename($_FILES['photo']['name']); $photoname = 'dir_photo_' . date('U') . '.' . pathinfo($uploadfile, PATHINFO_EXTENSION); if (!is_dir($uploaddir)) { mkdir($uploaddir, 0777, true); } if (!move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) { mysqli_close($db); die ('Файл не был загружен'); } if (!rename($uploadfile, $photoname)) { mysqli_close($db); die ('Ошибка переименования файла'); }