You are here

function file_load in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/file/file.module \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 modules/simpletest/tests/entity_crud_hook_test.test
Tests hook invocations for CRUD operations on files.
FileCopyTest::testExistingError in modules/simpletest/tests/file.test
Test that copying over an existing file fails when FILE_EXISTS_ERROR is specified.
FileCopyTest::testExistingRename in modules/simpletest/tests/file.test
Test renaming when copying over a file that already exists.
FileCopyTest::testExistingReplace in modules/simpletest/tests/file.test
Test replacement when copying over a file that already exists.
FileCopyTest::testNormal in modules/simpletest/tests/file.test
Test file copying in the normal, base case.

... See full list

File

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

Code

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