-
-
Save parzibyte/60b89595c7113df64118de2ad4518795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$btnEnviar.onclick = async () => { | |
// Convertir la imagen a Base64 y ponerlo en el enlace | |
const data = $canvas.toDataURL("image/png"); | |
const fd = new FormData(); | |
fd.append("imagen", data); // Se llama "imagen", en PHP lo recuperamos con $_POST["imagen"] | |
const respuestaHttp = await fetch("imagen.php", { | |
method: "POST", | |
body: fd, | |
}); | |
const nombreImagenSubida = await respuestaHttp.json(); | |
console.log("La imagen ha sido enviada y tiene el nombre de: " + nombreImagenSubida); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment