public function processInput($row, $postData) { $postData = parent::processInput($row, $postData); if (isset($postData[$this->getFieldName() . '_upload_id']) && (!isset($postData[$this->getFieldName()]) || $postData[$this->getFieldName()]['error'] == UPLOAD_ERR_NO_FILE)) { if (!$postData[$this->getFieldName() . '_upload_id']) { $postData[$this->getFieldName()] = null; } else { $splited = explode('_', $postData[$this->getFieldName() . '_upload_id']); if (count($splited) != 2) { throw new Kwf_Exception('Id doesn\'t consist of all needed parts.'); } $uploadsRow = $row->getModel()->getReferencedModel($this->getName())->getRow($splited[0]); if ($uploadsRow->getHashKey() != $splited[1]) { throw new Kwf_Exception('Posted hashKey does not match file-hashkey.'); } $postData[$this->getFieldName()] = $splited[0]; } unset($postData[$this->getFieldName() . '_upload_id']); } if (isset($postData[$this->getFieldName()]) && is_array($postData[$this->getFieldName()]) && isset($postData[$this->getFieldName()]['tmp_name'])) { //frontend formular, $_FILE werte $file = $postData[$this->getFieldName()]; unset($postData[$this->getFieldName()]); if ($file['error'] != UPLOAD_ERR_NO_FILE) { $fileModel = $row->getModel()->getReferencedModel($this->getName()); $fileRow = $fileModel->createRow(); $fileRow->uploadFile($file); $postData[$this->getFieldName()] = $fileRow->id; if (isset($postData[$this->getFieldName() . '_upload_id'])) { unset($postData[$this->getFieldName() . '_upload_id']); } } } if (isset($postData[$this->getFieldName() . '_del'])) { unset($postData[$this->getFieldName() . '_del']); $postData[$this->getFieldName()] = null; } if (isset($postData[$this->getFieldName()]) && $postData[$this->getFieldName()] === '') { $postData[$this->getFieldName()] = null; } return $postData; }