function file_load

7.x file.inc file_load($fid)

Loads a single file object from the database.

Parameters

$fid: A file ID.

Return value

An object representing the file, or FALSE if the file was not found.

See also

hook_file_load()

file_load_multiple()

Related topics

38 calls to file_load()
EntityCrudHookTestCase::testFileHooks in drupal-7.x/modules/simpletest/tests/entity_crud_hook_test.test
Tests hook invocations for CRUD operations on files.
FileCopyTest::testExistingError in drupal-7.x/modules/simpletest/tests/file.test
Test that copying over an existing file fails when FILE_EXISTS_ERROR is specified.
FileCopyTest::testExistingRename in drupal-7.x/modules/simpletest/tests/file.test
Test renaming when copying over a file that already exists.
FileCopyTest::testExistingReplace in drupal-7.x/modules/simpletest/tests/file.test
Test replacement when copying over a file that already exists.
FileCopyTest::testNormal in drupal-7.x/modules/simpletest/tests/file.test
Test file copying in the normal, base case.

... See full list

File

drupal-7.x/includes/file.inc, line 580
API for handling file uploads and server file management.

Code

function file_load($fid) {
  $files = file_load_multiple(array($fid), array());
  return reset($files);
}