/home/techb158/immovalet.com/platform/core/media/src/Chunks/Receiver
Edit: /home/techb158/immovalet.com/platform/core/media/src/Chunks/Receiver/FileReceiver.php (2587B)
request = $request;
$this->file = is_object($fileIndexOrFile) ? $fileIndexOrFile : $request->file($fileIndexOrFile);
$this->chunkStorage = $chunkStorage === null ? ChunkStorage::storage() : $chunkStorage;
if ($this->isUploaded()) {
if (!$this->file->isValid()) {
throw new UploadFailedException($this->file->getErrorMessage());
}
$this->handler = new $handlerClass($this->request, $this->file);
}
}
/**
* Checks if the file was uploaded.
*
* @return bool
*/
public function isUploaded()
{
return is_object($this->file) && UPLOAD_ERR_NO_FILE !== $this->file->getError();
}
/**
* Tries to handle the upload request. If the file is not uploaded, returns false. If the file
* is present in the request, it will create the save object.
*
* If the file in the request is chunk, it will create the `ChunkSave` object
* which doesn't nothing at this moment.
*
* @return bool|AbstractSave
*/
public function receive()
{
if (false === is_object($this->handler)) {
return false;
}
return $this->handler->startSaving($this->chunkStorage);
}
}