<?php include "../../root.class.php";
$db = new db_safeguard();

// // var_dump($_FILES);

try {
    $file_save_path = "../signatures/";

    $target_dir = $file_save_path;

    $target_file = $target_dir . "{$_SESSION['user_id']}-" . basename($_FILES["fileToUpload"]["name"]);

    $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));

    move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);

    echo "OK";

} catch (Exception $e) {
    echo $e->getMessage();
}