Jump to content

Downloading from php href


Eunico Cornelius
 Share

Recommended Posts

58 minutes ago, flydev said:

Hi,

check the doc :

 

Your link markup should be something like that :


<a href="{$page->myfilesfield->first->url}" download>download</a>

 

A tutorial :

 

I've seen this tutorial. However, I am trying to download the file by only using href="" and not tweaking _init.php. Let's say for example the file I have uploaded to the page is called sample.pdf . what would be the href parameter to download the file from the page?  

 

I tried this 

foreach ($page->files as $file) { 
        
        echo "<a href='{$page->files->url}' download>download {$file->name}</a><br>"; 
        
    }

but it gives me a 403 error.

Sorry I am new to this kind of thing.

Help anyone?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...