/**
  * Apply post-validation operations to the object.
  * @param object $obj Object being validated.
  * @access private
  */
 protected function _prepare_for_commit($obj)
 {
     parent::_prepare_for_commit($obj);
     /* Move the file to its final location and set the normalized file name. */
     $file = $this->upload_file_for('file_name');
     if (isset($file)) {
         $obj->file_name = $file->normalized_name;
         $url = new FILE_URL($obj->full_file_name());
         /** @var UPLOAD_FILE_FIELD $file_name_field */
         $file_name_field = $this->field_at('file_name');
         $this->_move_uploaded_file($file_name_field, $file, $url->path());
     }
     /* Create the thumbnail if needed. */
     if ($obj->is_image && $this->value_for('create_thumbnail')) {
         $class_name = $this->app->final_class_name('THUMBNAIL_CREATOR', 'webcore/util/image.php');
         /** @var THUMBNAIL_CREATOR $creator */
         $creator = new $class_name($this->app);
         $creator->create_thumbnail_for($obj->full_file_name(), $this->value_for('thumbnail_size'));
         if ($creator->error_message) {
             $this->record_error('create_thumbnail', $creator->error_message);
         }
     }
 }