function file_delete

Deletes a file and its database record.

Instead of directly deleting a file, it is strongly recommended to delete file usages instead. That will automatically mark the file as temporary and remove it during cleanup.

Parameters

$fid: The file id.

See also

file_unmanaged_delete()

file_usage()->listUsage()

Related topics

1 call to file_delete()
file_managed_file_submit in drupal/core/modules/file/file.module
Form submission handler for upload / remove buttons of managed_file elements.

File

drupal/core/includes/file.inc, line 919
API for handling file uploads and server file management.

Code

function file_delete($fid) {
  return file_delete_multiple(array(
    $fid,
  ));
}