But there are several cases in which you might benefit from using `UploadFile`.
-## `File` Parameters with `UploadFile`
+## File Parameters with `UploadFile`
-Define a `File` parameter with a type of `UploadFile`:
+Define a file parameter with a type of `UploadFile`:
```Python hl_lines="12"
{!../../../docs_src/request_files/tutorial001.py!}
Using `UploadFile` has several advantages over `bytes`:
-* You don't have to use `File()` in the default value.
+* You don't have to use `File()` in the default value of the parameter.
* It uses a "spooled" file:
* A file stored in memory up to a maximum size limit, and after passing this limit it will be stored in disk.
* This means that it will work well for large files like images, videos, large binaries, etc. without consuming all the memory.
## Optional File Upload
-You can make a file optional by using standard type annotations:
+You can make a file optional by using standard type annotations and setting a default value of `None`:
=== "Python 3.6 and above"
## `UploadFile` with Additional Metadata
-You can also use `File()` with `UploadFile` to set additional parameters in `File()`, for example additional metadata:
+You can also use `File()` with `UploadFile`, for example, to set additional metadata:
```Python hl_lines="13"
{!../../../docs_src/request_files/tutorial001_03.py!}
## Recap
-Use `File` to declare files to be uploaded as input parameters (as form data).
+Use `File`, `bytes`, and `UploadFile` to declare files to be uploaded in the request, sent as form data.