function file_load

Loads a single file entity from the database.

Parameters

$fid: A file ID.

Return value

Drupal\file\File A file entity or FALSE if the file was not found.

See also

hook_file_load()

file_load_multiple()

53 calls to file_load()
CopyTest::testExistingError in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test that copying over an existing file fails when FILE_EXISTS_ERROR is specified.
CopyTest::testExistingRename in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test renaming when copying over a file that already exists.
CopyTest::testExistingReplace in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test replacement when copying over a file that already exists.
CopyTest::testNormal in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test file copying in the normal, base case.
DeleteTest::testInUse in drupal/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
Tries deleting a file that is in use.

... See full list

File

drupal/core/modules/file/file.module, line 121
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

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