Upload PDF, Excel, Word Files to Drupal Content

Upload PDF, Excel, Word Files to Drupal Content

An OSTraining member asked how he could attach files such as PDFs, Excel Documents, Word Documents to his content.

There are many ways to do this in Drupal, but the easiest approach is to use the “File” field.

  • Login to your Drupal site.
  • Go to Structure > Content types.
  • You either add the field to an existing content type, or you can create a new one for specifically adding the files:

A Drupal content type for files

Now you add a field to the content type.

  • Click the blue “Add field” button.

Adding a Drupal field button

  • For the field type, choose “File”.
  • Give the field a meaningful label such as “attached file”.

Creating a Drupal file field

  • In the field settings, make sure the “Enable Display field” and “Fields displayed by default” options are selected:

Allowed file extensions in Drupal

It is important to make sure that you have added all the required file formats. In this example I will only be using PDF, but you can add as many file extensions you wish here.

5

When it comes to the size of file uploads, the maximum upload size is controlled by your server. Often, servers do not allow file uploads larger than 8MB. You will need to check your PHP settings if you want to increase the size of files that can be uploaded.

Now you have configured the content type, you can upload the files.

  • Go to Content > Add content.
  • Upload a file using the field that you created.
  • Your file will show on the front of the site:

A file displayed on a Drupal site

You can also change the display of the file:

  • Go to Structure > Content types > Manage display.

Changing the display settings for a Drupal file

Author

0 0 votes
Article Rating
Subscribe
Notify of
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Prabhu Shanmughapriyan
Prabhu Shanmughapriyan
6 years ago

Hi. can we do this programmatically ? I have 500+ files to be uploaded

Renee Siegel
Renee Siegel
2 years ago

What if i want to show the content of the spreadsheet? Not the link to it.

2
0
Would love your thoughts, please comment.x
()
x