function file_load

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

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

... See full list

File

drupal/includes/file.inc, line 593
API for handling file uploads and server file management.

Code

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