Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!