Drupal Association members fund grants that make connections all over the world.
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.
- Go to Administer → Content Types (
- For the Story node type, click on Manage Fields
- 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.
- 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.
- 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.
- Go to Administer → Site Building → Views (
- Click on the Add tab. Provide a view name for a "Node" view. Click Next
- Change the default settings as follows:
- Style: Table
Node: Type = Story
Content: File Attachments (field_file_attachments) – list = True
Content: File Attachments (field_file_attachments) - fid
Content: File Attachments (field_file_attachments)(Use the Generic Files fomat)
File: Size(use the File Attachments relationship)