Mongo Функции
PHP Manual

mongo_gridfile_write

(PECL mongo >= 0.8.0)

mongo_gridfile_writeWrite a file from the database to the local filesystem

Описание

int mongo_gridfile_write ( resource $gridfile , string $filename )

Write a file from the database to the local filesystem.

Список параметров

gridfile

The grid file.

filename

Name to save the file under.

Возвращаемые значения

Returns the number of bytes written.

Примеры

Пример #1 mongo_gridfile_write() example

This example shows a file being retreived from the database and saved to the local filesystem.

<?php

$conn 
mongo_connect("localhost"true);
if (!
$conn) {
   die(
"Could not connect.");
}
// create a new grid connection
$gridfs mongo_gridfs_init($conn"blog""fs");

// query for the filename
$file mongo_gridfs_find($gridfs, array("filename" => "profilePic.jpg"));
mongo_gridfile_write($file"pic.jpg");

?>


Mongo Функции
PHP Manual