File tree Expand file tree Collapse file tree 2 files changed +0
-29
lines changed
Expand file tree Collapse file tree 2 files changed +0
-29
lines changed Original file line number Diff line number Diff line change @@ -182,30 +182,4 @@ protected function getGridFsFileQuery()
182182 'length ' => intval ($ this ->request ->getTotalSize ())
183183 ];
184184 }
185-
186- /**
187- * Saves an uploaded file to disk. Must have been stored via {@link saveToGridFs} before.
188- *
189- * Note: conventional {@link \MongoGridFSFile::write} might fail on some platforms/driver versions - use this method.
190- *
191- * @param \MongoGridFS $gridFS
192- * @param \MongoId $fileId id of grid fs file
193- * @param string $fileName absolute or relative file name (existing file is deleted)
194- * @return bool true on successful write and false on failure
195- */
196- public static function writeFile (\MongoGridFS $ gridFS , \MongoId $ fileId , $ fileName )
197- {
198- if (file_exists ($ fileName )) {
199- unlink ($ fileName );
200- }
201- $ chunkEntries = $ gridFS ->chunks ->find (['files_id ' => $ fileId ])->sort (['n ' => 1 ]);
202- foreach ($ chunkEntries as $ chunkEntry ) {
203- /** @var \MongoBinData $data */
204- $ data = $ chunkEntry ['data ' ];
205- if (!file_put_contents ($ fileName , $ data ->bin , FILE_APPEND )) {
206- return false ;
207- }
208- }
209- return true ;
210- }
211185}
Original file line number Diff line number Diff line change @@ -38,9 +38,6 @@ if ($file->validateFile()) {
3838}
3939```
4040
41- To write a file to disk one might prefer ` \Flow\Mongo\MongoFile::writeFile($gridFs, $fileId, $file) ` over conventional
42- ` \MongoGridFsFile::write($file) ` , as the latter is not integrating on all platforms/drivers with this implementation.
43-
4441Delete unfinished files
4542-----------------------
4643
You can’t perform that action at this time.
0 commit comments