James Allan James Allan - 4 months ago 7
PHP Question

how to save a link in my server and load at the button href

I have post where it has a download button, and I want to save my download link in a row in my server. So in my site it loads the link in the button.

I made this:

<a href="'.$rows['link'].'" class="btn btn-primary col-lg-12 " role="button">Download</a>


But it does not open my download link.
When I click download it opens the link in my folder as a page, like this:

http://localhost/system/adm/www.mylink.com


I don't want to save the file in my folders, I want to save in my cloud so I can have huge downloads.

And post this link in my server so the post loads the link in my button.

What is the right way to make this work?

Answer

Links open locally if they don't have "http://" at the beginning, so just add it to all your links :

           ▼
<a href='http://" . $rows['link'] . "' class="btn btn-primary" role="button">Download</a> 
Comments