Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

245
Vistas
Send an Object with Blobs in it to server

I have a data object containing strings, booleans, arrays, objects and even Blobs like this:

enter image description here

Now I want to send this object to my Node.js server...

Using traditional fetch API or Ajax I'm unable to send the blobs and they appear like an empty object server side!

I tried to use fetch API even using FormData approach like:

Client:

const fd = new FormData();
fd.append("upload", data); // data is the object to send
fetch('/mother/new-card', {
    method: 'post',
    body: fd,
})

Server:

controller side:

router.post('/new-card', newCard);

function newCard(req, res) {
    motherService.newCard(req)
        .then(result => res.json(result))
        .catch(err => {
            console.log(err);
            res.json(err)
        });
}

Service side:

async function newCard(req) {
    console.log('req.body', req.body);
    return { success:  req.body }
}

I usually get undefined trying above methods ...

Is there any valid way to send an object with blobs in it?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda