You are here

function uploadfield_file_delete in Video 6.3

Implementation of hook_file_delete().

Delete the admin thumbnail when the original is deleted.

File

types/uploadfield/uploadfield_file.inc, line 20
hook_file and uploadfield file functions.

Code

function uploadfield_file_delete($file) {

  // delete thumb from files
  //  file_set_status($file->data['video_thumb_fid'], FILE_STATUS_TEMPORARY);
  db_query('DELETE FROM {files} WHERE fid = %d', $file->data['video_thumb_fid']);

  // delete thums directory
  $thumbs_path = variable_get('video_thumb_path', 'video_thumbs');

  //files will save in files/video_thumbs/#fileId folder
  $tmp = file_directory_path() . '/' . $thumbs_path . '/' . $file->fid . '/';

  //  rmdir($tmp);
  _file_delete_tree($tmp);

  //  if(@rmdir($tmp)) {
  //  }
}