Documentation Level: 
Documentation Status: 
No known problems

When you create a file field, you can specify the sub-directory of the site's file system where uploaded files for this content type will be stored. The site's file system paths are defined on the File system page Administer > Configuration > Media: File system.

You can also specify whether files are stored in a public directory or a private file storage area. Files in the public directory can be accessed directly through the web server; when public files are listed, direct links to the files are used, and anyone who knows a file's URL can download the file. Files in the private directory are not accessible directly through the web server; when private files are listed, the links are Backdrop path requests. This adds to server load and download time, since Backdrop must resolve the path for each file download request, but allows for access restrictions.

The best practice for public files is to store them in the files directory.

The default way to securely add a private directory for your files is to use a directory that can not be accessed directly by your web server but can be accessed by Backdrop. Ideally, this directory should be located outside of your Backdrop root folder.

The simple way to add a private directory for your files is to create a sub-directory under the public directory like:


When you specify the private directory in admin/config/media/file-system it will automatically create the sub-directory & create a simple .htaccess file with the following rule:

deny from all

This stops Apache from serving files from this directory. Make sure that you test this by adding a file to that directory and verifying that you can't browse there directly. If this isn't working, all files in this directory will be accessible to anyone who can guess the URL! Note that non-Apache web servers may need additional configuration to secure private file directories.

Whenever possible it's recommended that you choose a directory located outside of your Backdrop root folder (or actually outside your web root), which may be tricky if you are on a shared host. If you do have access, though, you can choose a private directory which will be on the same level as your web root directory (often called public_html or www or similar) using:


Note: The “Default download method” has to be changed to private at admin/config/media/file-system. This will make Backdrop apply checks to files.

Accessing Private Files

Once configured, files stored in the private directory are inaccessible via a direct link; however, if Backdrop constructs a link to the file, the file will be accessible to anyone who can see the link.

For example, you have created a new content type with a file field which stores files in your site's private file directory. Next, you create a node from this new content type and attach two new files. When the node is published links to both attached files are visible, and anyone who can view the node may download the files. Now, if you unpublish the node, all attached files become inaccessible for download even if you use the direct link to the files that worked when the node was published.

Re-publish the node, and disable the "Display" checkbox for one of the files. Save the node. Now one file is accessible for public download, and the other is not accessible--even if you have the direct URL for the file that is not listed, you will not be able to download this file.

For more fine-grained control of who can see/download attached files you will need an additional access control module. You may write a module yourself, or use a contributed module.