You are here

function _variable_file_upload_remove_file in Variable Extra 7

Remove old file with element key.

Parameters

string $name: An associative string of variable name.

1 call to _variable_file_upload_remove_file()
variable_file_form_file_managed_submit in variable_file/variable_file.variable.inc
Managed file, submit callback.

File

variable_file/variable_file.variable.inc, line 312
Variable module hook implementations

Code

function _variable_file_upload_remove_file($name) {
  $fid = variable_get_value($name);
  if ($fid && ($file = file_load($fid))) {
    file_usage_delete($file, 'variable_file', 'variable_file', 1);
    file_delete($file);
  }
}