Last updated 30 June 2010. Created on 30 May 2008.
Edited by quicksketch, keith_k, jpetso. Log in to edit this page.

Here are the basic steps for setting up a content type with a FileField field. For this example, I am going to show you how to add a field into a Story node.

  1. Go to Administer → Content Types (/admin/content/types)
  2. For the Story node type, click on Manage Fields
  3. Add a new field by selecting (i) a label, (ii) a machine-name for your field, (iii) data type of File, and a form element of File Upload. Click Save.
  4. You will enter the "settings" page for your new file type. Enter the file extenstions you wish to allow, file size limits, and so on. Check the "Required" box if you want to require your users to upload a file for all Story nodes. "Number of Values" can be used if you want to allow your users to upload more than one file into this Story node. Click Save Field Settings.
  5. You return to the Manage Fields administration page. Click on the Display Fields tab at the top. Here, you can choose if you want to display your field label. Choose Generic Files if you want to display a small icon and the file name when viewing the node’s teaser and full-node display.

For an example, let’s create a table with all Story nodes that have files, a link to the file, and the file size. With Views, you can easily do this.

  1. Go to Administer → Site Building → Views (/admin/content/types)
  2. Click on the Add tab. Provide a view name for a "Node" view. Click Next
  3. Change the default settings as follows:
    • Style: Table
    • Filters:

      Node: Published=Yes

      Node: Type = Story

      Content: File Attachments (field_file_attachments) – list = True
    • Relationships:

      Content: File Attachments (field_file_attachments) - fid
    • Fields:

      Node: Title

      Content: File Attachments (field_file_attachments) (Use the Generic Files fomat)

      File: Size (use the File Attachments relationship)

Looking for support? Visit the forums, or join #drupal-support in IRC.