Skip to content Skip to navigation

Getting Started on Sites: How to Attach Documents to Your Content

Welcome back!  This is the third blog post in a series on how to create a Drupal 7 personal website using Stanford Sites. Last time we looked at using the Quick Steps to get started editing our Sites website.

Now that you've got a few pages in your new website, you may be wondering how to attach a document to a page. First, you'll need to add a new field to the Basic page Content type for file attachments. Then you can either edit an existing page that you've already made, or you can create a new page, which is what I'll do in the following instructions.

Adding a file attachment field to your Content type

  1. Go to Structure > Content types > Basic page > Manage fields.

    Add new field

  2. Add new field and label it something like File attachment or Document.
  3. Click on the Select a field type arrow and select File.
  4. Select a widget should also be File.
  5. Click the Save button.
  6. Set the field settings that will apply to this field everywhere it is used in the website then click the Save field settings.

    Field settings

Adding a file to your Basic page content entry

  1. First, add a new page (or edit one you already have made). To add a new page, from the Admin menu, Go to Content > Add content > Basic page.

    Create Basic page

  2. Fill in the web form fields for Title and Body.

    Title and Body fields

  3. Below your body field is a FILE section. Files must be less than 50 MB and the allowed file types are txt, pdf, doc, docx, xls, xlsx, and rtf.  Click the "Browse..." button to locate the file that you going to upload.  Once you have selected the file, press the "Open" button. The file path will display in the file field.  Click the "Upload" button to upload your file to your page.

    Add a new file

  4. After clicking the "Upload" button, you will see your file.  The description is the text that will display. There are several options that you may choose to display the document.  You can click the "Insert" button to add a link to the document in your body text. You can also check the box in the "Display" column.  This tells Drupal to also display the file below the body field on your page. Should you need to, there is also an opportunity to upload additional documents using the "Add a new file" field below your already uploaded document.

    File information

  5. Finish making your edits to the the page. Don't forget to scroll down to the bottom and click the "Save" button. Your page should look something like this:

    Adding a Document page node

Next time, I'll show you how to add images to your pages.

Comments

For the file icon to display in your WYSIWYG, you may need to first enable the "link to file (with icon)" in the insert settings for the field. Then, when you insert the file into your text field, select "Link to file (with icon)".