Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Creating a Drupal 8 Private File System

Parent Feed: 
Creating a Drupal 8 Private File System

An OSTraining member asked how they could set up Drupal 8 private file system.

In Drupal 7 you could do this from the configuration at Administrator > Configuration > Media > File System. In Drupal 8 we have to set the private path manually.

  • Create a directory for the private files to be saved in:

01

You may want to use a name that won't be considered important. For this tutorial, I have simply called it 'private'. 

  • Go to your sites/default/settings.php. On line 533 you should find the setting we need to edit hashed out:

02

  • Remove the hash and enter the path for your private directly. In my case, this is 'sites/default/files/private':

03

  • Save and close settings.php file
  • Flush the cache which you can find in Administration > Configuration > Development > Performance:

04

  • Go to the File System and see if Drupal is detecting the private file storage: Administrator > Configuration > Media > File system

05

  • Select the private directory and save this configuration.

Drupal should automatically include a new .htaccess file inside the folder.

Now you have a private directory to store your files in.


About the author

Daniel is a web designer from UK, who's a friendly and helpful part of the support team here at OSTraining.

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web