getParsedBody(); $files = $request->getUploadedFiles(); $file = $files['archivo']; $filename = implode(DIRECTORY_SEPARATOR, [ $container->get('folders.upload'), $post['filename'] . '.pdf' ]); $file->moveTo($filename); $status = (file_exists($filename) and filemtime($filename) == time()); $output = [ 'informacion' => $post, 'estado' => $status, 'archivo' => $filename ]; $response->getBody()->write(json_encode($output)); return $response ->withHeader('Content-Type', 'application/json') ->withStatus(201); } }