Documentation Level: 
Documentation Status: 
No known problems

Working with files in Backdrop

The File module enables you to upload and attach files to content, and to manage these uploads if you have the appropriate permissions. This module is responsible for validating file content, and managing uploaded files. It also provides options for displaying media assets.

As a site administrator, you will be able to control what type of files can be uploaded, and their maximum size.

The File module provides its functionality by defining a File field type for the Field module. File attachments are defined at the content type level (or other entities). To learn how to define a field and add it to a content type, see Working with the Field UI.

Adding a file field to a content type

Navigate to the "Manage Fields" tab of the content type to which you wish to add the file field, Administer > Structure > Content types, and the link manage fields for your specific content type.

Select the field type file, give the field a label and machine name, click-and-drag it to the place you want to have it among your fields, and hit the save button.

As when adding any new field, you are first required to set the field specific settings. These apply for all places where you use the field. These cannot be changed per entity.

When checked, the Enable Display field option allows users to choose if a file should be shown when viewing the content.
The Files displayed by default option makes the display file option checked by default when users upload files to this field.
The Upload destination by default only has the public files option available – making the files available right from the server (without Backdrop checking any access). If you want to use private files, you must first change some settings at the file system administration page (Administer > Configuration > Media: File system). See below for details.

The next step is to set the field settings for this instance only. This can be changed between different content types (or other entities).

You can add validation options for the File field when you configure the content type. You must list all of the file extensions that the final user will need to be able to upload. The optional file directory where the files will be uploaded is a subdirectory of the file system path defined in the file system administration page Administer > Configuration > Media: File system. You may specify a maximum file size for each file uploaded.

Managing attachment display

Once a file has been attached to content, you can specify whether it will be displayed in the list of attached files or not. Listed files are displayed automatically in a section at the bottom of the content; non-listed files can, for example, be embedded in your content, but are not included in the list. (Embedding a file in your content means you copy the path of the file and manually embed it where you want, for example, to insert in the content as a link tag. Note that the text format "Filtered HTML" by default refuses any image tags..)

Additional options for managing the display of the file list are available in the "Manage Display" tab of the specific content type's administration page (Administer > Structure > Content types and the link field display for your content type).