code: public function handleManualUpload($file, ResponseInterface $response, Request $request = null)
      {
          if (!$request) {
              $request = new Request();
          }
          $this->setRequest($request);
          $this->handleUpload($file, $response, $request);
          $files = $response->assemble();
          if (0 === count($files)) {
              throw new \UnexpectedValueException('File upload returned empty response');
          }
  
          return array_pop($files);
      }
docs: @param FileInterface|HttpFile $file
  @param ResponseInterface      $response
  @param Request|null           $request
  
  @throws \UnexpectedValueException
  
  @return ResourceInterface