Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/docs/guides/input/file-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def create_user(request, details: UserDetails, file: File[UploadedFile]):
```

this will expect from the client side to send data as `multipart/form-data with 2 fields:

- details: JSON as string
- file: file

Expand All @@ -96,7 +96,7 @@ If you would like the file input to be optional, all that you have to do is to p

```python
@api.post('/users')
def create_user(request, details: Form[UserDetails], avatar: File[UploadedFile] = None):
def create_user(request, details: Form[UserDetails], avatar: Optional[File[UploadedFile]] = None):
user = add_user_to_database(details)
if avatar is not None:
set_user_avatar(user)
Expand Down Expand Up @@ -141,5 +141,3 @@ When Django Ninja detects a PUT or PATCH etc methods with multipart/form-data a


Note: This middleware does not interfere with normal POST behavior or any other methods.