public function MongoFile::saveToGridFs in One Click Upload 7.2
Merge all chunks to single file
Parameters
$metadata array additional metadata for final file:
Return value
\MongoId|bool of saved file or false if file was already saved
Throws
\Exception
File
- flowphp/
src/ Flow/ Mongo/ MongoFile.php, line 132
Class
- MongoFile
- Notes:
Namespace
Flow\MongoCode
public function saveToGridFs($metadata = null) {
$file = $this
->getGridFsFile();
$file['flowStatus'] = 'finished';
$file['metadata'] = $metadata;
$result = $this->config
->getGridFs()
->findAndModify($this
->getGridFsFileQuery(), $file);
// on second invocation no more file can be found, as the flowStatus changed:
if (is_null($result)) {
return false;
}
else {
return $file['_id'];
}
}