O'Reilly logo

Drupal 7 Module Development by Ken Rickard, John Wilkins, Larry Garfield, Matt Butcher, Greg Dunlap, Matt Farina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File API

In Drupal 6, most file handling functionality was provided through a rough core API combined with contributed modules such as Filefield. Drupal 7 provides a more robust and consistent API that allows developers to interact with files in a standard set of functions that perform tasks like creating, opening, moving, and deleting files.

In order for files to be associated with nodes and other Drupal content, they must have a record in Drupal's file table. Each record identifies a file with a unique ID as well as associated metadata like file size and mime-type.

Many File API functions, such as file_copy() and file_move(), take a file object as one of their arguments. The file object is a PHP standard class containing the metadata from the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required