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

161
Visualizações
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
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