Skip to content

Commit 34afa29

Browse files
committed
docs: add note about UploadedFile instance when no file was uploaded
1 parent 19da2d3 commit 34afa29

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

user_guide_src/source/incoming/incomingrequest.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ multi-file upload, based on the filename given in the HTML file input::
316316

317317
$files = $request->getFileMultiple('userfile');
318318

319+
.. note:: The files here correspond to ``$_FILES``. Even if a user just clicks submit button of a form and does not upload any file, the file will still exist. You can check that the file was actually uploaded by the ``isValid()`` method in UploadedFile. See :ref:`verify-a-file` for more details.
320+
319321
Content Negotiation
320322
-------------------
321323

user_guide_src/source/libraries/uploaded_files.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ Which would return a simple array like::
194194
'avatar' => // UploadedFile instance
195195
]
196196

197+
.. note:: The UploadedFile instance corresponds to ``$_FILES``. Even if a user just clicks the submit button and does not upload any file, the instance will still exist. You can check that the file was actually uploaded by the ``isValid()`` method in UploadedFile. See :ref:`verify-a-file`.
198+
197199
If you used an array notation for the name, the input would look something like::
198200

199201
<input type="file" name="my-form[details][avatar]" />
@@ -302,7 +304,9 @@ Working With the File
302304
Once you've retrieved the UploadedFile instance, you can retrieve information about the file in safe ways, as well as
303305
move the file to a new location.
304306

305-
Verify A File
307+
.. _verify-a-file:
308+
309+
Verify a File
306310
=============
307311

308312
You can check that a file was actually uploaded via HTTP with no errors by calling the ``isValid()`` method::

0 commit comments

Comments
 (0)