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

153
Views
Can't download while connecting to the server on my network while on the phone

quick question. So this is the code:

export const downloadImage = async (state) => {
   try {
      let response = await axios.get(state.url, {
         responseType: "blob",
      });
      const url = window.URL.createObjectURL(new Blob([response.data]));
      const link = document.createElement("a");
      link.href = url;
      link.setAttribute("download", state.url.slice(18));
      document.body.appendChild(link);
      link.click();
   } catch (err) {
      console.log(err);
   }
};

EDIT: Don't mind the slicing in the setAttribute and the state gives me the full info about the pic, url, text etc.

It works prefectly, when i click download it downloads the img.

Since im using react when i do npm start it starts the live server and when i try to connect to it through my phone (which is on the same wifi network), and i connect with my IPv4 address and react port number (Example: 182.1281.12:3000) the image wont download...

So even tho the code is the same, it works on my PC and won't on my Phone, why is that?

Thanks.

about 4 years ago · Santiago Gelvez
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!