You are here

function filefield_clear_field_session in FileField 5

Same name and namespace in other branches
  1. 5.2 filefield.module \filefield_clear_field_session()
2 calls to filefield_clear_field_session()
filefield_clear_session in ./filefield.module
filefield_widget in ./filefield.module
Implementation of hook_widget().

File

./filefield.module, line 235
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 $files) {
      foreach ($files as $delta => $file) {
        if (is_file($file['filepath'])) {
          file_delete($file['filepath']);
        }
      }
    }
    unset($_SESSION['filefield'][$fieldname]);
  }
}