Documentation for "Setting up a content type with a FileField field"
keith_k - August 18, 2009 - 22:32
| Project: | FileField |
| Version: | 6.x-3.1 |
| Component: | Documentation |
| Category: | task |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Here's my response to request for documentation at http://drupal.org/node/264828
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 (
/admin/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. (see Figure 1)
- 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 (
/admin/content/types) - Click on the Add tab. Provide a view name for a "Node" view. Click Next
- Change the default settings as follows (see Figure 2):
- Style: Table
- Filters:
Node: Published=YesNode: Type = StoryContent: File Attachments (field_file_attachments) – list = True - Relationships:
Content: File Attachments (field_file_attachments) - fid - Fields:
Node: TitleContent: File Attachments (field_file_attachments)(Use the Generic Files fomat)File: Size(use the File Attachments relationship)
| Attachment | Size |
|---|---|
| figure_1.jpg | 24.44 KB |
| figure_2.jpg | 41.4 KB |

#1
Should I just post this at http://drupal.org/node/264828 myself?
#2
Awesome work keith_k! Yep, feel free to just edit and post that directly (any user can write handbook pages). However, you might request to join the documentation team, just post to http://drupal.org/project/issues/documentation saying you'd like to join, and link to this issue to point out that you have some pictures to add (only doc team members can post pictures).
#3
Looks like this was already added. Marking as fixed.
#4
The screenshots were never moved over.
#5
very odd.
Feel free to edit the doc page, add the HTML to pull the images which are attached to this issue and I'll flip the input format if needed.