Using SS as a file distributor for downloading

Silverstripe Version: installed with the Composer around 10-05-2024

Question: Please forgive me but i can’t find discussion regarding a target i’d like to implement with SS. English is not my mother language so i don’t know the exact terms for this kind of search…

I have a very limited experience with Silverstripe, but i’m looking if i could use it for making some nested page for distributing online pdf documents (in my case: music scores for orchestra’s members).
The problem is that i can link in a page a document (loaded with the CMS mechanism) one at a time, but i should link a large batch of documents, divided per folders into other folders.
The editor will have no time to do this, file per file…

Is there a way, an extension, a mechanism, for doing what i tried to describe?
Or please can someone redirect me to some discussion in this forum, or elsewhere, for doing this?

Many thanks in advance.
Marco Brancalion.

When dealing with collections (items, people, recipes… whatever) you never use pages directly. Instead you create a dedicated controller that accesses your own DataObjects or (as it seems in your case) the File DataObject directly.

Just add a route to your controller, e.g.:

    'myurl': MyController

and then do whatever you want by adding PHP code there. In your case using wildcard patterns seems the way to go, e.g.:

use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest;

class MyController extends Controller
    private static $url_handlers = [
        '$@' => 'index',

    public function index(HTTPRequest $request)
        // In `$request` you have what you need: do whatever you want!
        // In this example, accessing '/myurl/folder1/folder2/file' will
        // show 'Array ( [$1] => folder1 [$2] => folder2 [$3] => file )'

        return print_r($request->allParams(), true);

I thank you very much for you reply. I took note of every line you wrote… :slight_smile:

I am very “virgin” with Silverstripe, in every aspect of it.
When i’ll have a moment for trying, i’ll try to implement the advice you gave me.

Thanks !