Skip to content

Commit af8020c

Browse files
committed
edits
1 parent 34a6abf commit af8020c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

source/includes/write/gridfs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function toJSON(object $document): string
3939

4040
// Uploads data to a stream, then writes the stream to a GridFS file
4141
// start-upload-from-stream
42-
$file = fopen('/path/to/file', 'rb');
42+
$file = fopen('/path/to/input_file', 'rb');
4343
$bucket->uploadFromStream('new_file', $file);
4444
// end-upload-from-stream
4545

@@ -75,7 +75,7 @@ function toJSON(object $document): string
7575

7676
// Downloads an entire GridFS file to a download stream
7777
// start-download-to-stream
78-
$stream = fopen('/path/to/output-file', 'wb');
78+
$stream = fopen('/path/to/output_file', 'wb');
7979
$bucket->downloadToStream(
8080
new ObjectID('66e0a5487c880f844c0a32b1'),
8181
$stream,

source/write/gridfs.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ You can upload files to a GridFS bucket by using the following methods:
152152
- ``MongoDB\GridFS\Bucket::uploadFromStream()``: Uploads the contents of
153153
an existing stream to a GridFS file
154154

155+
.. _gridfs-open-upload-stream:
156+
155157
Write to an Upload Stream
156158
~~~~~~~~~~~~~~~~~~~~~~~~~
157159

@@ -183,7 +185,7 @@ information in an options array, which you can pass as a parameter.
183185

184186
This example performs the following actions:
185187

186-
- Calls the ``fopen()`` method to open a file located at ``/path/to/file``
188+
- Calls the ``fopen()`` method to open a file located at ``/path/to/input_file``
187189
as a stream in binary read (``rb``) mode
188190
- Calls the ``uploadFromStream()`` method to upload the contents of the stream
189191
to a GridFS file named ``'new_file'``
@@ -219,7 +221,7 @@ Example
219221

220222
The following code example shows you how to retrieve and print file metadata
221223
from files in a GridFS bucket. It uses a ``foreach`` loop to iterate through
222-
the returned cursor and display the contents of the file uploaded in the
224+
the returned cursor and display the contents of the files uploaded in the
223225
:ref:`gridfs-upload-files` examples:
224226

225227
.. io-code-block::
@@ -279,7 +281,7 @@ create a download stream.
279281
This example uses a download stream to perform the following actions:
280282

281283
- Selects a GridFS file named ``'my_file'``, uploaded in the
282-
:ref:`gridfs-upload-files` example, and opens it as a readable stream
284+
:ref:`gridfs-open-upload-stream` example, and opens it as a readable stream
283285
- Calls the ``stream_get_contents()`` method to read the contents of ``'my_file'``
284286
- Prints the file contents
285287
- Calls the ``fclose()`` method to close the download stream pointing to ``'my_file'``
@@ -356,7 +358,7 @@ on your bucket.
356358

357359
This example performs the following actions:
358360

359-
- Calls the ``fopen()`` method to open a file located at ``/path/to/output-file``
361+
- Calls the ``fopen()`` method to open a file located at ``/path/to/output_file``
360362
as a stream in binary write (``wb``) mode
361363
- Downloads a GridFS file that has an ``_id`` value of ``ObjectID('66e0a5487c880f844c0a32b1')``
362364
to the stream

0 commit comments

Comments
 (0)