Forum
Members Download
Hello,
I am looking to add a download link to the member's profiles, I am looking to test things so I don't mind using the 'Default' resource bucket that comes with Perch.
I don't seem to get things to work when I visit the link: /download.php?file=/document.docx
The error I get is: Fatal error: Call to undefined function perch_members_default_download() in /profile/download.php on line 27
My download.php code is as follows:
<?php
include('../perch/runtime.php');
// config
$bucket_name = 'default';
$url_param = 'file';
// By default, deny downloads unless we've proved the member is allowed this file.
$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_default_download(perch_get($url_param), $bucket_name);
}
exit;
At the moment my aim is to add a simple download link to the profiles that links to the default resource bucket as a download.
Help appreciated
Thanks
If download.php is in the root of your site then I think your Perch include path is incorrect.
Otherwise we'll need to see your Diagnostics Report.
Hello Rachel,
Thank you, you were correct in your thinking the download now works, however I still seem to have this as an error?
Fatal error: Call to undefined function perch_members_secure_download() in htdocs/profile/download.php on line 16
We will need to see your Diagnostics Report, it's a good idea to add that with every post (which is why we ask for it) as otherwise it just delays you getting an answer.