Cris
Cris

Reputation: 12204

Drupal6: how to handle private and public file storage?

What I need is a module to give private folders (only the owner can access the content, as the user_files module but with the create and change directory) and public (per role) access (only the members of a certain role can access the folder). It would be great to have a file explorer module that handles this.

Is there any similar module?

Upvotes: 1

Views: 950

Answers (1)

Josep Valls
Josep Valls

Reputation: 5560

I had similar requirements but I implemented my own module. First of all, there are several ways you can have private files. You must either set all your files private so they go through the Drupal bootstrap or configure the individual folders where there is access restriction to go through the Drupal bootstrap. There are several tutorials if you Google it: http://www.google.es/search?q=drupal+public+private+files

Myself I added a .htaccess

RewriteEngine on
RewriteBase /path/to/my/private/directory
RewriteRule ^(.*)$ $1 [L,R=301]

Then you can just implement HOOK_file_download($filepath) in your custom module.

http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_file_download/6

Also, check this nice tutorial:

http://www.drupalcoder.com/blog/mixing-private-and-public-downloads-in-drupal-6

Upvotes: 1

Related Questions