8.5.x file.module file_load($fid, $reset = FALSE)
8.0.x file.module file_load($fid, $reset = FALSE)
8.1.x file.module file_load($fid, $reset = FALSE)
8.2.x file.module file_load($fid, $reset = FALSE)
8.3.x file.module file_load($fid, $reset = FALSE)
8.4.x file.module file_load($fid, $reset = FALSE)
8.6.x file.module file_load($fid, $reset = FALSE)
7.x file.inc 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

32 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


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


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


WillHall’s picture

If you want to say get just the uri of the item the snippet has changed since D6. Using views to print just the delta(fid) as the field content we would do:

$ifid = strip_tags($fields['field_wallpaper']->content);
$imgpath = file_load($ifid)->uri;
print file_create_url($imgpath);
mikeytown2’s picture

field_file_load() in the filefield module

tassaf’s picture

I have file field, in the settings of that field I am changing the filename and the path

in hook_node_update I am using file_load() to get the data for that file, but I am still getting the origin name and path for the file, Not the new name and path

Any suggestions please?

dman’s picture

It still exists in Drupal8, but should be replaced with

suncorjohn’s picture

I am using the Drupal Web-To-Lead module to send webform values to Salesforce (Professional Edition). All of the fields are sent over file except the URLs for images users upload to the webform using the Multiple File Upload module. It's sending the [fid] value="1234" unique number assisgned to every file uploaded. I really want the file URL to be sent to Salesforce.

It's strange because when the webform send an email, the uploaded image URLs are being sent over?

Any ideas as to how I can resolve this and send the uploaded image URL to Salesforce, vs. the [fid]?