Mongo Funktionen
PHP Manual

mongo_gridfile_write

(PECL mongo >= 0.8.0)

mongo_gridfile_writeWrite a file from the database to the local filesystem

Beschreibung

int mongo_gridfile_write ( resource $gridfile , string $filename )

Write a file from the database to the local filesystem.

Parameter-Liste

gridfile

The grid file.

filename

Name to save the file under.

Rückgabewerte

Returns the number of bytes written.

Beispiele

Beispiel #1 mongo_gridfile_write() example

This example shows a file being retrieved 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 Funktionen
PHP Manual