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?


I would opt for this structure

    /documents <-- HERE

/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.


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.


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