diff options
Diffstat (limited to 'tests/http/upload.php')
-rw-r--r-- | tests/http/upload.php | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/tests/http/upload.php b/tests/http/upload.php deleted file mode 100644 index 57526246..00000000 --- a/tests/http/upload.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; - -function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface -{ - $files = $req->getUploadedFiles(); - array_walk_recursive($files, function (&$v) { - /** - * @var \Psr\Http\Message\UploadedFileInterface $v - */ - - if ($v->getError()) { - $v = [ - 'name' => $v->getClientFilename(), - 'size' => $v->getSize(), - 'mime' => $v->getClientMediaType(), - 'error' => $v->getError(), - ]; - } else { - $v = [ - 'name' => $v->getClientFilename(), - 'size' => $v->getSize(), - 'mime' => $v->getClientMediaType(), - 'error' => $v->getError(), - 'sha512' => hash('sha512', $v->getStream()->__toString()), - ]; - } - }); - - $resp->getBody()->write(json_encode($files, JSON_UNESCAPED_SLASHES)); - - return $resp; -} |