function _file_resource_delete in Services 6.3
Same name and namespace in other branches
- 7.3 resources/file_resource.inc \_file_resource_delete()
Delete a file.
Parameters
$fid: Unique identifier of the file to delete.
Return value
bool Whether or not the delete was successful.
1 string reference to '_file_resource_delete'
- _file_resource_definition in resources/
file_resource.inc - THERE SHOULD BE NO UPDATE!!! Drupal doesn't allow updating or replacing a file in the files table. If you need to, create a new file and remove the old file.
File
- resources/
file_resource.inc, line 331 - File resource.
Code
function _file_resource_delete($fid) {
// Fetch details of the file.
$file = db_fetch_array(db_query('SELECT * FROM {files} WHERE fid = %d', $fid));
// Remove data from {files} table.
db_query('DELETE FROM {files} WHERE fid = %d', $fid);
// Remove file physically.
return file_delete($file['filepath']);
}