Drupal 7: How to set file system paths?

Drupal’s File module allows to upload and attach the files to content. File module will use default locations to store and manage the files. Drupal allows you to set the locations where Drupal will store the files. Most of the times we can go with the default locations (file system paths) which are defined at the time of Drupal installation. But some times there will be a need like restrict access to files publicly; we need to set out own file system paths.

This article explains the steps to set file system paths in Drupal 7.

Step 1. Login into your Drupal based website as an administrator.

Step 2. Click on Configuration menu which is on top of administration page. Drupal will display a Configuration page.

Drupal - Configuration page

Drupal – Configuration page

Step 3. Select File system link; which is under MEDIA group. Drupal will display File system options page.

Drupal 7 - File System page

Drupal 7 – File System page

Step 4. On File system page, enter the following:

  • Enter public file system path into Public file system path field. This is the location where Drupal will place public access file. These files can be accessed directly.
  • Set private file system path into Private file system path field. The files stored into this location are not accessible directly.
  • And location of temporary files can be stored into the path mentioned in Temporary directory field. This is the location where Drupal will store temporary files. Once you change this temporary directory path, Drupal will start using this updated temporary directory to store temporary files.

Step 5. Once you click on Save configuration to save your changes.

If you set private file system path, upload a sample file into the private file system path and try to access the path through your web-browser. Drupal should not allow you to access the file; if it allows, there should be an error. Resolve the error before publishing the site into public. Otherwise, we can access the files stored in private file system path; which should not happened.


Leave a Reply