/** * Writes the file to the system. * @param string $filename The location to which to write the file. * If none is given, the stored filename will be used. * @return integer number of bytes written or False on error. * @since v1.3 */ public function write($filename = null) { Yii::trace('Trace: ' . __CLASS__ . '::' . __FUNCTION__ . '()', 'ext.MongoDb.EMongoGridFS'); if (method_exists($this->_gridFSFile, 'write') === true) { return $this->_gridFSFile->write($filename); } else { return false; } }
/** * Writes this file to the given filename path. * * @param string $filename * @return boolean TRUE if successful, and FALSE otherwise. */ public function write($filename) { if ($this->isDirty && $this->bytes) { return file_put_contents($filename, $this->bytes); } if ($this->isDirty && $this->filename) { return copy($this->filename, $filename); } if ($this->mongoGridFSFile instanceof \MongoGridFSFile) { return $this->mongoGridFSFile->write($filename); } throw new \BadMethodCallException('Nothing to write(). File is not persisted yet and is not dirty.'); }
public function testWrite() { $bytes = $this->object->write('tests/anotherfile'); $this->assertEquals($bytes, 129); $this->assertEquals(filesize('tests/anotherfile'), $this->object->getSize()); }
public function dump($filename) { $this->file->write($filename); }
public function testWrite() { $bytes = $this->object->write('tests/classic.jpg'); $this->assertEquals(13, $bytes); }