Skip to content

Commit f4d7536

Browse files
sliptonictiangolo
authored andcommitted
📝 Add notes about installing python-multipart for forms (fastapi#574)
1 parent fadfe4c commit f4d7536

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

docs/tutorial/request-files.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
You can define files to be uploaded by the client using `File`.
22

3+
!!! info
4+
To receive uploaded files, first install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
5+
6+
E.g. `pip install python-multipart`.
7+
8+
This is because uploaded files are sent as "form data".
9+
310
## Import `File`
411

512
Import `File` and `UploadFile` from `fastapi`:

docs/tutorial/request-forms-and-files.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
You can define files and form fields at the same time using `File` and `Form`.
22

3+
!!! info
4+
To receive uploaded files and/or form data, first install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
5+
6+
E.g. `pip install python-multipart`.
7+
38
## Import `File` and `Form`
49

510
```Python hl_lines="1"

docs/tutorial/request-forms.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
When you need to receive form fields instead of JSON, you can use `Form`.
22

3+
!!! info
4+
To use forms, first install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
5+
6+
E.g. `pip install python-multipart`.
7+
38
## Import `Form`
49

510
Import `Form` from `fastapi`:

docs/tutorial/security/first-steps.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ Copy the example in a file `main.py`:
2424

2525
## Run it
2626

27+
!!! info
28+
First install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
29+
30+
E.g. `pip install python-multipart`.
31+
32+
This is because **OAuth2** uses "form data" for sending the `username` and `password`.
33+
2734
Run the example with:
2835

2936
```bash

0 commit comments

Comments
 (0)