<?php

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

require_once('lib/CallbackForm.php');
include_once('lib/FormWithEmail.php');
require_once('lib/FormFactory.php');

$name = isset($_POST['name']) ? trim($_POST['name']) : '';
$phone = isset($_POST['phone']) ? trim($_POST['phone']) : '';
$email = isset($_POST['email']) ? trim($_POST['phone']) : ' ';
$uploadFile = isset($_FILES['uploadFile']) ? ($_FILES['uploadFile']) : [];
$formType = isset($_POST['formType']) ? trim($_POST['formType']) : '';

$form = FormFactory::getForm($formType, $name, $phone, $email, $uploadFile);
if ($form->validate()) {
    $form->send();
    $form->uploadFile();
} else {
    echo 'Введите корректные данные';
}