Upload PDF, Excel, Word Files to Drupal Content

Parent Feed: 
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


About the author

Daniel is a web designer from UK, who's a friendly and helpful part of the support team here at OSTraining.

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web