How can I download a file if I have its URL? Always open the file and shows its text. Code below doesn't work :(
I get the URL by consuming an API. I don't have the chance to receive in other way.
<a href="https://dominio.com/report.txt" download="reporte.txt" target="_blank">Descargar</a>
CodePudding user response:
I guess you just need to define the download tag like this below,
<a href="https://dominio.com/report.txt" download="reporte.txt">
<strong>Descargar</strong>
</a>
CodePudding user response:
Change the url has given below its downloaded correctly.
<a href="/dominio.com/report.txt" download="reporte.txt" target="_blank">Descargar</a>