How to Add a Filed to Upload and Attach Files to Drupal Articles
When creating new articles for Drupal, there are some predefined fields like title, body, image, tags and etc. But you can add so many other fields. You do not need to install any additional modules as all these are prebuilt in Drupal CMS.
To add more fields to Drupal articles, you need to follow these steps:
Go to the admin panel of Drupal, then click on the Manage item and from the appeared items, click on Structure.
Now you will see some items to choose from like: Block layout, Comment types, Contact forms, Content types, Display modes and etc. Click on Content types.
Now when you want to add a field to upload files to Drupal articles, click on Manage Fields.
Now you see the predefined fields which are: Body, comments, image and tags. To add a new field, click on Add field.
There are so many fields you can add to your articles. Some of them are: Boolean, comments, dates, timestamp, email link, numbers (as integer, decimal, float etc.), content, file, image, user, and text (as list, plain etc.).
From the Reference, choose the File, then you need to choose a Label for it.
In this example, we type Upload Files as the label. You can type any name for it.
Now you have different options to:
- Change the label you have chosen at previous step.
- Add help and instructions for this new upload field.
- Make this field as required. In this case you can not successfully submit articles without uploading files.
- Type allowed file extensions in addition to default TXT format. You should separate the extensions with comma or space.
- Choose Optional subdirectory within the upload destination where files will be stored.
- Set maximum upload size.
- Enable Description field to let users to enter a description about the uploaded files.
Make sure to select allowed file extensions and maximum file size because these are the most important factors for uploading files.
Click on Save settings and now you have successfully added a field to upload and attach files to your Drupal articles.
You can always edit the properties and settings of this newly created field and all other fields of Drupal anytime you would need.