/**
  * @param ServerRequestInterface $request
  * @param ResponseInterface      $response
  * @return ResponseInterface
  */
 public function onPost(ServerRequestInterface $request, ResponseInterface $response)
 {
     /** @var UploadedFile $upload */
     $uploaded = $request->getUploadedFiles();
     $upload = $uploaded['up'][0];
     $viewData = $this->responder->getViewData()->setData('isUploaded', true)->setData('dump', print_r($uploaded, true))->setData('upload', $upload)->setData('error_code', $upload->getError());
     return $this->viewer->__invoke($request, $response, $viewData);
     // callable
 }
Beispiel #2
0
 /**
  * @param ServerRequestInterface $req
  * @param ResponseInterface      $res
  * @param Exception              $e
  * @return ResponseInterface
  */
 public function __invoke(ServerRequestInterface $req, ResponseInterface $res, $e)
 {
     $viewData = $this->responder->getViewData()->setError('Error.' . $e->getMessage());
     return $this->responder->error($req, $res)->asView(501, $viewData);
 }
Beispiel #3
0
 /**
  * take care the uploaded file.
  * show the upload form with uploaded file information.
  *
  * @param ServerRequestInterface  $request
  * @param ResponseInterface $response
  * @return ResponseInterface
  */
 public function onPost(ServerRequestInterface $request, ResponseInterface $response)
 {
     $viewData = $this->responder->getViewData()->setSuccess('redirected back!')->setInputData($request->getParsedBody())->setInputErrors(['jumped' => 'redirected error message']);
     return $this->responder->redirect($request, $response)->toPath('jump', $viewData);
 }