file_load

  1. drupal
    1. 8
    2. 7
Versions
8 – 7 file_load($fid)

Load a file object from the database.

Parameters

$fid A file ID.

Return value

A file object.

See also

hook_file_load()

file_load_multiple()

Related topics

▾ 38 functions call file_load()

EntityCrudHookTestCase::testFileHooks in modules/simpletest/tests/entity_crud_hook_test.test
Test 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.
FileDeleteTest::testInUse in modules/simpletest/tests/file.test
Tries deleting a file that is in use.
FileDeleteTest::testUnused in modules/simpletest/tests/file.test
Tries deleting a normal file (as opposed to a directory, symlink, etc).
FileFieldTestCase::assertFileEntryExists in modules/file/tests/file.test
Assert that a file exists in the database.
FileFieldTestCase::assertFileEntryNotExists in modules/file/tests/file.test
Assert that a file does not exist in the database.
FileLoadTest::testLoadMissingFid in modules/simpletest/tests/file.test
Try to load a non-existent file by fid.
FileLoadTest::testSingleValues in modules/simpletest/tests/file.test
Load a single file and ensure that the correct values are returned.
FileMoveTest::testExistingError in modules/simpletest/tests/file.test
Test that moving onto an existing file fails when FILE_EXISTS_ERROR is specified.
FileMoveTest::testExistingRename in modules/simpletest/tests/file.test
Test renaming when moving onto a file that already exists.
FileMoveTest::testExistingReplace in modules/simpletest/tests/file.test
Test replacement when moving onto a file that already exists.
FileMoveTest::testExistingReplaceSelf in modules/simpletest/tests/file.test
Test replacement when moving onto itself.
FileMoveTest::testNormal in modules/simpletest/tests/file.test
Move a normal file.
FileSaveDataTest::testExistingError in modules/simpletest/tests/file.test
Test that file_save_data() fails overwriting an existing file.
FileSaveDataTest::testExistingRename in modules/simpletest/tests/file.test
Test file_save_data() when renaming around an existing file.
FileSaveDataTest::testExistingReplace in modules/simpletest/tests/file.test
Test file_save_data() when replacing an existing file.
FileSaveDataTest::testWithFilename in modules/simpletest/tests/file.test
Test the file_save_data() function when a filename is provided.
FileSaveDataTest::testWithoutFilename in modules/simpletest/tests/file.test
Test the file_save_data() function when no filename is provided.
FileSaveUploadTest::testNormal in modules/simpletest/tests/file.test
Test the file_save_upload() function.
FileTokenReplaceTestCase::testFileTokenReplacement in modules/file/tests/file.test
Creates a file, then tests the tokens generated from it.
file_example_get_managed_file in examples/file_example/file_example.module
Utility function to check for and return a managed file. In this demonstration code we don't necessarily know if a file is managed or not, so often need to check to do the correct behavior. Normal code would not have to do this, as it would be…
file_field_presave in modules/file/file.field.inc
Implements hook_field_presave().
file_managed_file_process in modules/file/file.module
Process function to expand the managed_file element type.
file_managed_file_validate in modules/file/file.module
An #element_validate callback for the managed_file element.
file_managed_file_value in modules/file/file.module
The #value_callback for a managed_file type element.
hook_field_prepare_view in modules/field/field.api.php
Prepare field values prior to display.
ImageExampleTestCase::testImageExamplePage in examples/image_example/image_example.test
Tests for image block provided by module.
ImageFieldDisplayTestCase::testImageFieldDefaultImage in modules/image/image.test
Test use of a default image with an image field.
image_example_style_form in examples/image_example/image_example.pages.inc
Form for uploading and displaying an image using selected style.
image_example_style_form_submit in examples/image_example/image_example.pages.inc
Form Builder; Display a form for uploading an image.
image_field_delete_field in modules/image/image.module
Implements hook_field_delete_field().
image_field_prepare_view in modules/image/image.field.inc
Implements hook_field_prepare_view().
image_field_update_field in modules/image/image.module
Implements hook_field_update_field().
system_cron in modules/system/system.module
Implements hook_cron().
template_preprocess_user_picture in modules/user/user.module
Process variables for user-picture.tpl.php.

Code

includes/file.inc, line 552

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