$imagen_decodificada = base64_decode(filter_input(INPUT_POST, 'imagen'));
$proceso = filter_input(INPUT_POST, 'proceso', FILTER_SANITIZE_SPECIAL_CHARS);
$nombre = filter_input(INPUT_POST, 'nombre', FILTER_SANITIZE_SPECIAL_CHARS);
$foto = $proceso . " " . $nombre . ".jpg";
try {
$results = file_put_contents("http://xxx.xxx.xxx.x/mipc/fotos2/" . $foto, $imagen_decodificada);
if (!$results) {
die("No se guardo la imagen.");
}
echo "Datos guardados.";
$dbh = null;
} catch (PDOException $e) {
echo $e->getMessage();
}
?>