Forum

Thread tagged as: Problem, Members

Downloadable Document from Secure Bucket Assets

Hello,

How do I go about creating a download link that can be pre-set within a members profile page, so every new member has it there straight away, ready to download on sign up?

I have try different ways from looking at perch documents nothing seems to work for me.

My site link shows as: /members/download.php?file=/document.docx

The link does not download, where could I be going wrong please? Or what perch docs best cover what I'm looking to do?

much appreciated

Gary Thompson

Gary Thompson 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What are you doing in your download.php page?


<?php include('perch/runtime.php'); // config $bucket_name = 'secure'; $url_param = 'file'; // By default, deny downloads unless we've proved the member is allowed this file. $allow_download = false; // Check a member is logged in if (perch_member_logged_in()) { $allow_download = true; } /* Alternatively, you could check for a specific tag, e.g. if (perch_member_has_tag('subscriber')) { $allow_download = true; } */ // Deliver the file. if ($allow_download) { perch_members_secure_download(perch_get($url_param), $bucket_name); } exit;
Drew McLellan

Drew McLellan 2638 points
Perch Support

What happens when you follow the link?

The page goes blank with URL as: /members/download.php?file=/document.docx

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you get any errors logged?