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

126
Vistas
How to send jpg to backend though to cloudinary?

I have the following:

fil = file:///storage/emulated/0/Android/data/com.test/files/Pictures/7601d776-7ca4-44b0-99cf-d8c0bb4c14e9.jpg , (Image.path for android Generated by react-native-image-crop-picker . when I use the below code to send this to the backend, it has an error with cloudinary while the Image.path for IOS fil = /Users/test/Library/Developer/CoreSimulator/Devices/.../data/Containers/Data/Application/.../tmp/react-native-image-crop-picker/.../.jpg does not have an error. Why is this the cases since they are both grabbed from Image.path for react-native-image-crop-picker ?

const res = await client.post('/upload-avatar',{fil},{headers:{
        Accept : 'application/json',
        authorization: 'some JWT'
       }})

back end:

        try{
            
            const upload_result = await cloudinary.uploader.upload(req.body.fil, {
                public_id: `${user._id}_profile`,
                width:500,
                height:500,
                crop: 'fill'
            })
            res.status(201).json({success:true,message: "good"})
            
        }catch (error){
            res.status(500).json({success:false,message: "Error"})
        }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

per @Michalk: Enable the includeBase64: true option for the picker

Instead of Image.path use: data:${image.mime};base64,${image.data}

const res = await client.post('/upload-avatar', JSON.stringify({ data: fil }), {
    headers: {
        'Content-type' : 'application/json',
        authorization: 'JWT JWT
    }
});
about 4 years ago · Juan Pablo Isaza Denunciar
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