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

118
Vistas
How to use image binary data from PHP backend in navigator.share files option?

I have a php backend that gives me binary img data. It uses file_get_contents('myImageUrl') and returns the result to my front-end using axios. The file_get_contents result looks like this:

enter image description here

What I want is to use this to share the image via javascript navigator.share() option. I came this far:

let url = this.$store.dispatch("api/myendpoint");
Promise.all([
    url
])
.then((data) => {
    const filesArray = new File([data[0]], "filename.png", {type: data[0].type})
    navigator.share({
        text: 'See this image',
        files: filesArray,
    })
})
.catch((error) => {
    console.log(error)
});

But it the console I get the following error:

Uncaught (in promise) TypeError: Failed to execute 'share' on 'Navigator': Failed to read the 'files' property from 'ShareData': The object must have a callable @@iterator property.
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