file_load

7 file.inc file_load($fid)
8 file.inc file_load($fid)

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

38 calls to file_load()

File

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

Code

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

Comments

Accessing individual items in the object

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);

Login or register to post comments