Forum

Thread tagged as: Runway, Members

Runway secure downloads

If I'm using secure downloads in Runway, do I need to configure anything differently from what is shown in the Members App documentation?

I've got everything working correctly, except being able to download the file.

If I navigate to /members/download.php?file=/document.pdf I get a page not found error.

If I navigate to /members/download?file=/document.pdf I get a blank page.

Do I need to change the web_path at all in buckets.php, or do I need to create a route for the download.php page in admin?

Darren Neasham

Darren Neasham 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What routes do you have set up for the download?

In my first post, I hadn't got any routes set up for the download. I've since tried creating a custom token because I thought the normal slug:file would only match the filename, and not the .pdf at the end

'fileslug' => '[a-z0-9\-]+\.[a-z]{3}'

And then configured my route as /members/download/[fileslug:file]

The web_path for the secure folder in buckets.php is /members/download

But that doesn't work. And this is where I've got stuck. I'm not really sure if I should be creating a route, or changing the web_path, or both!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that looks good. How does it fail, and what does the debug say?

It doesn't download the file. The page loads without an error message, but nothing else happens. I've checked the secure folder and the pdf document is definitely there, so it would seem the download page isn't pulling the file.

Debug Message
SELECT * FROM perch2_members_sessions WHERE sessionID='566fdc0049d0056a0a1ea30c7f3570fed1187317' AND sessionHttpFootprint='8c9193b898e8ce6ca2392de92f14744c30b32229' AND sessionExpires>'2015-07-29 10:48:14' LIMIT 1
User is logged in
SELECT * FROM perch2_pages WHERE pagePath='/perch/core/runway/start.php' LIMIT 1
SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC
Matched route: members/download/[fileslug:file]
Using master page: /templates/pages/members/download.php
Page arguments:
Array
(
    [0] => /members/download/document-1.pdf
    [file] => document-1.pdf
    [1] => document-1.pdf
)

I've now tested the secure downloads on a Perch installation to see if the same issue occurred - which it did.

On the Perch installation, I got an error log appear in the members folder, and it turns out to be

PHP Fatal error:  Call to undefined function mime_content_type() in …perch/addons/apps/perch_members/runtime.php on line 300

I turned on all error reporting in Runway and it's the same error, so I now know what is causing the issue.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does your server have the PHP fileinfo extension installed?

No, not currently. I'm going to get it installed. Thanks for your responses Drew - much appreciated.