Index: trunk/core/kernel/utility/formatters/upload_formatter.php =================================================================== diff -u -r6093 -r6583 --- trunk/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 6093) +++ trunk/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 6583) @@ -72,6 +72,12 @@ $object->SetDBField($options['content_type_field'], $value['type']); } $ret = getArrayValue($options, 'upload_dir') ? $real_name : $this->DestinationPath.$real_name; + + // delete previous file, when new file is uploaded under same field + $previous_file = isset($value['upload']) ? $value['upload'] : false; + if ($previous_file && file_exists($this->FullPath.$previous_file)) { + unlink($this->FullPath.$previous_file); + } } } } @@ -158,7 +164,7 @@ function GetFormatted($tc_value, &$options) { - if ($options['format'] == 'img_size') { + if (isset($options['format']) && ($options['format'] == 'img_size')) { $upload_dir = isset($options['upload_dir']) ? $options['upload_dir'] : $this->DestinationPath; $img_path = FULL_PATH.'/'.$upload_dir.$tc_value;