
Ramiro Godoy
PreguntaBuenas, estoy teniendo el siguiente error, al presionar el botón de subir foto de michi:
“Uncaught (in promise) TypeError: Failed to construct ‘FormData’: parameter 1 is not of type ‘HTMLFormElement’.”
Alguna sugerencia, por favor?

Ramiro Godoy
ufff, no se como no ví ese error. Que grande Juan, te agradezco!!!

Juan Castro
En tu HTML tienes el nombre del form en el atributo action, no en el atributo id. :eyes:

Ramiro Godoy
Gracias Juan! si si, te paso, primero va el HTML y más abajo el código de JS
<section id="uploadingMichi"> <h2>Sube la foto de tu gato</h2> <form action="uploadingForm"> <input id="file" type="file" name="file" /> <button type="button" onclick="uploadMichiPhoto()"> Subir foto del gato </button> </form> </section``` ///// async function uploadMichiPhoto() { const form = document.getElementById('uploadingForm') const formData = new FormData(form); console.log(formData.get('file')) const res = await fetch(API_URL_UPLOAD, { method: 'POST', headers: { 'X-API-KEY': 'df50328b-fd66-4802-896a-a3219ea30bfe', }, body: formData, }) }

Juan Castro
Hello, Ramiro! ¿Podrías por fa mostrarnos tu código para ayudarte a identificar el error?