You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/parsers.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ using the `APIView` class based views.
51
51
return Response({'received data': request.data})
52
52
53
53
Or, if you're using the `@api_view` decorator with function based views.
54
-
54
+
55
55
from rest_framework.decorators import api_view
56
56
from rest_framework.decorators import parser_classes
57
57
@@ -93,7 +93,9 @@ You will typically want to use both `FormParser` and `MultiPartParser` together
93
93
94
94
Parses raw file upload content. The `request.data` property will be a dictionary with a single key `'file'` containing the uploaded file.
95
95
96
-
If the view used with `FileUploadParser` is called with a `filename` URL keyword argument, then that argument will be used as the filename. If it is called without a `filename` URL keyword argument, then the client must set the filename in the `Content-Disposition` HTTP header. For example `Content-Disposition: attachment; filename=upload.jpg`.
96
+
If the view used with `FileUploadParser` is called with a `filename` URL keyword argument, then that argument will be used as the filename.
97
+
98
+
If it is called without a `filename` URL keyword argument, then the client must set the filename in the `Content-Disposition` HTTP header. For example `Content-Disposition: attachment; filename=upload.jpg`.
97
99
98
100
**.media_type**: `*/*`
99
101
@@ -105,6 +107,7 @@ If the view used with `FileUploadParser` is called with a `filename` URL keyword
105
107
106
108
##### Basic usage example:
107
109
110
+
# views.py
108
111
class FileUploadView(views.APIView):
109
112
parser_classes = (FileUploadParser,)
110
113
@@ -115,6 +118,11 @@ If the view used with `FileUploadParser` is called with a `filename` URL keyword
0 commit comments