MongoGridFSFile::getBytes

(PECL mongo >=0.9.0)
Returns this file's contents as a string of bytes
public string MongoGridFSFile::getBytes ( void )

Warning: this will load the file into memory. If the file is bigger than your memory, this will cause problems!

Returns:

Returns a string of the bytes in the file.

Examples:
MongoGridFSFile::getBytes() example
<?php

$images = $db->my_db->getGridFS('images');

$image = $images->findOne('jwage.png');

header('Content-type: image/png;');
echo $image->getBytes();
?>

doc_php
2016-02-24 16:20:53
Comments
Leave a Comment

Please login to continue.