Where I should create a folder for private user documents for download

Hello, I'm having trouble deciding where in phalconphp file estructure can I create a folder with private user documents for download. Some of these files are private and others are public. I want to give access to them through the application.

Where should I create the folder? Sholud I create a download class?

Thanks.

I would opt for this structure

/app
    /controllers
    /models
    /views
/library
    /My
        /Services
/var
    /cache
    /config
    /documents <-- HERE
    /logs
    /volt
/public
    /js
    /img
    /css

/public is what the end user can access, where your index.php is located.

Creating a download class is definitely the way forward since you will be able to allow/deny access to any document you need to from the app itself.



12.5k

Should I copy the file for download to a public folder before it gets downloaded or that's unnecessary? Thanks Nikolaos.

There is no need really. If user A requests a document and they are allowed to get it, you send the appropriate headers back with the response (from your download class) and then the file itself. If the user does not have permissions you just send them a 404 page or something like that.



12.5k

Ok, I'll do that. Thanks! :D