<?php
require("conexion.php");
$cons = $_POST['folio'];
$comen = $_POST['ComentarioFirma'];
    $folderPath = "upload/";
    $image_parts = explode(";base64,", $_POST['signed']); 
    $image_type_aux = explode("image/", $image_parts[0]);
    $image_type = $image_type_aux[1];
    $image_base64 = base64_decode($image_parts[1]);
    $file = $folderPath . $cons.'.'.$image_type;
    file_put_contents($file, $image_base64);

    $q = mysqli_query($conexion,"INSERT INTO RelacionFirmas VALUES (DEFAULT,$cons,'$file',1,'$comen')");
?>