function file_load

7.x file_load($fid)

Loads a single file object from the database.


$fid: A file ID.

Return value

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

See also



Related topics

38 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


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


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