<?php include dirname(__FILE__) . '/../../wbLoader.php'; WBParam::set('wb/session/container', 'Null'); WBClass::load('WBUser'); $user = WBUser::getCurrent(); /** @var $user WBUser_Auth */ $cred = array( 'nickname' => 'gerd', 'password' => 'gerd123' ); $user->login($cred); $uid = $user->getId(); $formDef = array(); $formDef['file01'] = array( 'type' => 'Vfsfile', 'attributes' => array( 'user' => 0 ) ); $formDef['file02'] = array( 'type' => 'Vfsfile', 'attributes' => array( 'user' => 1, 'required' => 'no' ) ); $params = array(); $params['elements'] = $formDef; $form = WBClass::create('patForms', $params); $values = array(); $errors = array(); if (isset($_FILES) && !empty($_FILES)) { $form->setSubmitted(true); if (!$form->validateForm()) { $errors = $form->getValidationErrors(); } else { $values = $form->getValues(); } } ?> <html> <head> </head> <body> <h2>User</h2> User Id: <?php echo $user->getId(); ?><br /> <h2>Files</h2> <?php echo '<pre>' . var_export($values, true) . "</pre>\n"; echo '<pre>' . var_export($_FILES, true) . "</pre>\n"; ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" accept-charset="utf-8" enctype="multipart/form-data"> <?php foreach ($formDef as $name => $def) { $el = $form->getElementByName($name); echo $name . ": "; echo $el->serialize(); echo '</br >' ."\n"; } echo '<pre>' . var_export($errors, true) . "</pre>\n"; ?> <input type="submit" value="save" name="save" /> </form> </body> </html>