You are here

function imagefield_clear_field_session in ImageField 5

Same name and namespace in other branches
  1. 5.2 imagefield.module \imagefield_clear_field_session()
3 calls to imagefield_clear_field_session()
imagefield_clear_session in ./imagefield.module
imagefield_field in ./imagefield.module
Implementation of hook_field().
_imagefield_widget_prepare_form_values in ./imagefield.module

File

./imagefield.module, line 341
Defines an image field type. imagefield uses content.module to store the fid, and the drupal files table to store the actual file data.

Code

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