Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Serving Files with the Secure File Module, SS3.1

Go to End

2 Posts   993 Views


Community Member, 70 Posts

5 November 2013 at 3:30am

I've run into a problem trying to get the secure files module work with SS3.1, but it appears the issue has existed since SS3.0 - I am using this branch,

Whilst the editing interface seems fine, the issue is one of actually downloading the secure file. If I go to a URL such as /assets/Uploads/mysecurefolder/image.jpg I get the following error:

Action 'Uploads' isn't available on class SecureFileController.

When I activate debug (by adding debug=1 and debug_request=1 to the URL of the file being downloaded) I observe the following:

Debug (line 258 of RequestHandler.php): Rule '$Action//$ID/$OtherID' matched to action 'handleAction' on SecureFileController. Latest request params: array ( 'Action' => 'Uploads', 'ID' => 'committeefiles', 'OtherID' => '7', )

Thus the issue appears to be one of routing. The file for routing that comes with the module is here,

For secure files to work, files need to be served by the following function:

protected function handleAction($request, $action) { 

I've spent half a day or so looking at this but I am not winning, hence I am asking for help. I cannot immediately see a way of configuring silverstripe routes to either

i) Mapping a URL of /identifier/part1/part2/part3/..../partN to the handleAction method above
ii) Mapping a URL of /identifier/part1/part2/part3/..../partN to another specific action only (a use case I can think of here is likes of /facets/published/1930-1940/author/A/ for a faceted book search for example)

The issue is possibly one of the correct ordering of routes, but I am not experienced enough with this particular functionality of SS3 to resolve the above problem.

Previous mentions of this problem: (this suggests things broke as of 3.0.4) (line 253)

It would be good to get this problem fixed as it is an important module and it would benefit the community as a whole. I would also like to fully understand the intricacies of the routing, though this may be an edge case.

Kind regards



Community Member, 70 Posts

6 November 2013 at 6:36am

It turns out the version of SilverStripe I'd installed with composer was broken. I reinstalled on a clean slate and things worked as expected