Jump to:

1169 Posts in 2694 Topics by 411 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Serving Files with the Secure File Module, SS3.1

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1
Go to End
Author Topic: 583 Views
  • elgordo
    Community Member
    70 Posts

    Serving Files with the Secure File Module, SS3.1 Link to this post

    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, http://github.com:timsnadden/silverstripe-securefiles.git

    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, https://github.com/timsnadden/silverstripe-securefiles/blob/3.1/_config/routes.yml

    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:
    http://www.silverstripe.org/upgrading-silverstripe/show/23966 (this suggests things broke as of 3.0.4)
    http://logs.simon.geek.nz/index.php?date=2013-06-14 (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


  • elgordo
    Community Member
    70 Posts

    Re: Serving Files with the Secure File Module, SS3.1 Link to this post

    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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.