code: protected function updateFolderName(HTTPRequest $request)
      {
          // check if allowed to select folder
          if (!$this->getCanSelectFolder()) {
              return;
          }
  
          // Get path from upload
          $folderID = $request->requestVar("{$this->Name}/folder");
          $path = $this->folderPathFromID($folderID);
          if ($path !== false) {
              $this->setFolderName($path);
              $this->selectField->setValue($folderID);
          }
      }
docs: Given a request, ensure that the current field is aware of the selected folder
  
  @param HTTPRequest $request