Today I released the final 3.0 versions of both FileField and ImageField for Drupal 6, bringing to close the long journey for a stable, final release of the de-facto CCK image handling solution.

A small time line (in dd/mm/yyyy format):

  • 05/10/2007 - Hook file proposed for inclusion in Drupal 6
  • 02/13/2008 - Drupal 6 released (without hook file)
  • 06/24/2008 - First alpha release of FileField 1.x for Drupal 6
  • 07/31/2008 - RC1 of FileField 2.0 scrapped to start on a new hook file based version
  • 08/08/2008 - First alpha release of ImageField 3.x for Drupal 6
  • 10/08/2008 - Hook file included in Drupal 7
  • 03/15/2009 - New betas of FileField strip out crufty APIs
  • 04/20/2009 - Final versions released

And here we are! Nearly 2 years after the original concept of hook_file() was created and the work on FileField 3.0 began.

Let's take a tour through the final version and see what we have!

The FileField Widget

Probably the most exciting improvement is the addition of upload progress indication. This enhancement requires the PECL uploadprogress PHP extension, but adds a real asset to sites that use FileField for podcasts, videos, or other large files.

The upload field in action. Uploading with the uploadprogress extension installed.


After uploading a file, a simple preview and additional fields become available. "Description" and "List" fields may be toggled per instance.

Support for Revisions and Translations

FileField contains a backport (or actually the predecessor) of hook_file(), which is now part of Drupal 7 core. This allows FileField to manage files across revisions and translations with ease.

The ImageField Widget

ImageField is now completely dependent on FileField for its data handling. This means less duplicated, less bugs, and more compatibility between add-on modules. If an add-on module works for FileField, it automatically works for ImageField. This means that ImageField is now purely a "widget" for CCK, not a "field" any more.

Setting up a new Image field is now based on the "File" field type.


Uploading an image is just the same as FileField, only an image thumbnail is shown in the preview.

For Developers...

Devel Generate

FileField now has full support for Devel Generate, so you can populate an entire image gallery with a single click. FileField respects minimum and maximum image sizes during content creation, with randomly generated images.

Generated content with populated file and image fields.

Hook file support

Other modules can use FileField's hook_file() implementation to help determine when and where a file is in use. This means modules like the new FileField Sources module can reuse existing images on multiple nodes, even use IMCE to browse existing images and reuse them (as long as the files are assigned an FID in the database).

Using FileField Sources or other to-be made modules, reuse existing images or files on multiple nodes.

An Extensive Public API

FileField contains some super-handy API functions that let you easily grab files or nodes from the database based on limited information:

  • filefield_get_field_list() - Get a list of file (or image) fields within a node type.
  • filefield_get_file_reference_count() - Count how many times a file is in use.
  • filefield_get_file_references() - Get a list of all nodes that use a particular file.
  • filefield_get_node_files() - Get a list of all files that are attached to a node within one or all fields.
  • Plus hook file and all the goodness it brings.

And other goodies

The long development cycle of ImageField and FileField didn't deter people from building on the alpha and beta versions, a lot of cool project have appeared to build on the flexibility of these modules.

The stabilization of these modules means even more projects will build on them in the future. With a final version done for Drupal 6, it's time to look forward to Drupal 7 and make FileField join its friends: CCK in core, ImageAPI in core, and ImageCache in core.

Published in

If you enjoyed this Article, you may also enjoy...

Nate Lampton

Nate Lampton standing in front of greenery.
Nate Lampton is a leader in Open Source with over a decade of contributions to the Drupal project. He joined Lullabot in 2006.