private function prepareUpload()
{
$contextOptions = $this->getContextOptions();
if (isset($contextOptions[$this->protocol]['upload'])) {
$upload = $contextOptions[$this->protocol]['upload'];
if (!$upload instanceof Upload) {
throw new InvalidConfigException('"upload" context option should be an instance of "' . Upload::className() . '"');
}
$this->upload = $upload;
return true;
}
$collection = $this->fetchCollection();
$this->upload = $collection->createUpload(['document' => $this->queryParams]);
return true;
}