pquery($sql,$params); $rowCount = $db->num_rows($result); if($rowCount > 0) { $id = $db->query_result($result,0,'organization_id'); $meta = $this->getMeta(); $element['id'] = vtws_getId($meta->getEntityId(), $id); return $this->update($element); }else{ $element = $this->handleFileUpload($element); return parent::create($elementType, $element); } } function handleFileUpload($element) { $fileFieldList = $this->meta->getFieldListByType('file'); foreach ($fileFieldList as $field) { $fieldname = $field->getFieldName(); if(is_array($_FILES[$fieldname])) { $element[$fieldname] = vtws_CreateCompanyLogoFile($fieldname); } } return $element; } public function update($element) { $element = $this->handleFileUpload($element); return parent::update($element); } } ?>