Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda