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_move(), take a file object as one of their arguments. The file object is a PHP standard class containing the metadata from the ...