code: protected function getUploadedAttachment($path = null)
      {
          $attachment = [];
          $file = $path;
          if ($this->request instanceof ServiceRequestInterface) {
              $file = $this->request->getFile('file', $this->request->getFile('attachment', $path));
          }
  
          if (is_array($file)) {
              if (isset($file['tmp_name'], $file['name'])) {
                  $attachment[] = new Attachment($file['tmp_name'], array_get($file, 'name'));
              } else {
                  foreach ($file as $f) {
                      if (isset($f['tmp_name'], $f['name'])) {
                          $attachment[] = new Attachment(array_get($f, 'tmp_name'), array_get($f, 'name'));
                      }
                  }
              }
          }
  
          return $attachment;
      }
docs: Gets uploaded file(s) for attachment.
  
  @param null|string|array $path
  
  @return array