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");
?>