<?php
$formNames = [
'Заявление и согласие на обработку персональных данных',
'Что-то ещё'
];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
foreach ($_FILES['userFile']['name'] as $k => $name) {
$filename = $formNames[$k] . '.' . pathinfo($name, PATHINFO_EXTENSION);
$uploadFile = __DIR__ . DIRECTORY_SEPARATOR . $filename;
move_uploaded_file($_FILES['userFile']['tmp_name'][$k], $uploadFile);
}
}
?>
<form enctype="multipart/form-data" method="post">
<?php foreach ($formNames as $formName) { ?>
<p><?=$formName?><br><input type="file" name="userFile[]"></p>
<?php } ?>
<input type="submit" value="Отправить">
</form>