From 1a599d5ebd743f1ffbc1acf6f9bde64b10474efa Mon Sep 17 00:00:00 2001 From: cexll Date: Fri, 27 Nov 2020 15:09:57 +0800 Subject: [PATCH] Update Factory.php An uploaded file must be an array or an instance of UploadedFile. --- src/Factory.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Factory.php b/src/Factory.php index 7520383..1d37029 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -98,13 +98,19 @@ private function getRequest(): Request { $request = $this->container->get(RequestInterface::class); //return $this->container->get(RequestInterface::class); + $uploadFiles = $request->getUploadedFiles() ?? []; + $files = []; + foreach ($uploadFiles as $k => $v) { + $files[$k] = $v->toArray(); + } return new Request( $request->getQueryParams(), $request->getParsedBody(), [], $request->getCookieParams(), - $request->getUploadedFiles(), - is_array($_SERVER) ? $_SERVER : $_SERVER->toArray(), + $files, + $request->getServerParams(), +// is_array($_SERVER) ? $_SERVER : $_SERVER->toArray(), $request->getBody()->getContents() ); }