You are here

function filefield_clear_field_session in FileField 5.2

Same name and namespace in other branches
  1. 5 filefield.module \filefield_clear_field_session()
3 calls to filefield_clear_field_session()
filefield_clear_session in ./filefield.module
filefield_field in ./filefield.module
Implementation of hook_field().
_filefield_widget_prepare_form_values in ./filefield.module

File

./filefield.module, line 349
Defines a file field type.

Code

function filefield_clear_field_session($fieldname) {
  if (is_array($_SESSION['filefield'][$fieldname]) && count($_SESSION['filefield'][$fieldname])) {
    foreach ($_SESSION['filefield'][$fieldname] as $delta => $file) {
      if (is_file($file['filepath'])) {
        file_delete($file['filepath']);
      }
    }
    unset($_SESSION['filefield'][$fieldname]);
  }
}