Trouble with file upload link

  • OK, possible stupid mistake alert here! I haven't been working much with Perch lately (and have pregnancy baby brain) ....


    So I am adding a file upload field and want to output the link in a shared region in the footer of all pages. The file is uploading, but the link on the website is empty:


    Code
    1. <a href="<perch:content id="terms" type="file" label="Terms & Conditions PDF" accept="pdf">" target="_blank">Terms &amp; Conditions</a>

    Am I making an embarassingly obvious mistake here?!

  • drewm

    Approved the thread.
  • Yep. Just a shared region on the footer of all pages. The full code in the template file is:


    Code
    1. <perch:if exists="terms"><span><a href="<perch:content id="terms" type="file" label="Terms & Conditions PDF" accept="pdf" output="path">" target="_blank">Terms &amp; Conditions</a></span> &nbsp;| &nbsp;</perch:if>

    Which basically hides the link if no file is uploaded. It works, as it shows when a file is uploaded and then disappears again if I delete it. It just isn't showing the url to the file in the href for some reason.

  • Not much help, I suppose, but I entered your code and it worked fine. I first tried it as a region on the page and that worked, so then moved it to a shared region and that worked the same. The file opens in a different tab as expected.